Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

0580 An open failed because the file was oversize and the opener did not ... in C program ( FILE_OPEN_)

199 views
Skip to first unread message

francisco lopez Chile

unread,
Jun 20, 2013, 12:41:23 PM6/20/13
to
hello i have a big problem when try to open KeySequence FILE, this file is a Format 2 File. I need to open the file and then apply setmode 141.
The purpose is to know whens records have this File trought Bulk i/o.32k.

how to fix this error without convert this file to Format 1?



source code

filename = "$pene.PERAMA.CRD01B";


i_options = ZSYS_VAL_OPENOPT_UNSTRUCTACC;


FILE_OPEN_(filename,
(short)strlen(filename),
&filenum,
CW_ACCESS_R,
CW_EXCL_SHARE,
,
CW_NO_SYNC_DEPTH,
i_options
);

$PENE.PERAMA.CRD01B
ENSCRIBE
TYPE K
FORMAT 2
EXT ( 60000 PAGES, 60000 PAGES )
REC 4040
BLOCK 4096
KEYLEN 51
KEYOFF 4
MAXEXTENTS 978
OWNER 200,109
SECURITY (RWEP): CCCC
DATA MODIF: 16 Sep 2011, 13:24
CREATION DATE: 16 Sep 2011, 12:39
LAST OPEN: 20 Jun 2013, 12:39
FILE LABEL: 688 (16.9% USED)
EOF: 10352861184 (8.6% USED)
EXTENTS ALLOCATED: 85
INDEX LEVELS: 4


JShepherd

unread,
Jun 20, 2013, 1:23:08 PM6/20/13
to
In article <fdff2ebf-52b1-4a2b...@googlegroups.com>,
panch...@gmail.com says...
>
>hello i have a big problem when try to open KeySequence FILE, this file is
a Fo
>rmat 2 File. I need to open the file and then apply setmode 141.
>The purpose is to know whens records have this File trought Bulk i/o.32k.
>
>how to fix this error without convert this file to Format 1?
>
>
>
>source code
>
>filename = "$pene.PERAMA.CRD01B";
>
>
> i_options = ZSYS_VAL_OPENOPT_UNSTRUCTACC;
>
>
> FILE_OPEN_(filename,
> (short)strlen(filename),
> &filenum,
> CW_ACCESS_R,
> CW_EXCL_SHARE,
> ,
> CW_NO_SYNC_DEPTH,
> i_options
> );
>

Change the unstructured open to use the elections parameter

SETMODE 141 is optional, you can do 28K/56K unstructured reads without it


int32_t elections = 1; /* format 2 files */
short options = 0x8000;
short nowait = 0;
short syncdepth = 1;
short erc;
short fnum = -2;

erc = FILE_OPEN_(filename,filename_len, &fnum,
ZSYS_VAL_OPENACC_READWRITE,
ZSYS_VAL_OPENEXCL_SHARED,
nowait,
syncdepth,
options,
/* sbb */,
/* sbblen */,
/* phandle */,
elections);

wbreidbach

unread,
Jun 21, 2013, 2:47:39 AM6/21/13
to
As the file accessed is structured, setmode 141 is needed. For unstructured files there is no need for this.

The clue is indeed the elections parameter allowing 64-bit values for addressing.

Anyway, accessing a key-sequential file as an unstructured file, you will get whole blocks and not records! You would have to fetch the records from the blocks yourself. The sequence of the records in this case is undefined and unpredictable! This would only make sense for very special applications.

If you want to do buffered I/O on record base there are 2 possibilities:
1. Change the file to buffered: FUP ALTER <filename>, buffered
2. Add the parameter seq-block-buffer-len (> 0) to the file_open_
In both cases neither setmode 141 no the elections parameter is needed.

Keith Dick

unread,
Jun 21, 2013, 5:08:27 AM6/21/13
to
If the program in question intends to process the file record-by-record, there also are several other techniques.

One is to read the file in COBOL -- either do the whole processing in a COBOL program or just do the file reading in COBOL and do the rest of the processing in C or whatever you like. When you specify the appropriate number of alternate areas in the SELECT for the file in COBOL, and meet a couple other conditions, the COBOL library use a fast I/O library that isn't generally available to read structured files. That uses large transfers, but understand the structure of the file so it can return the records in the correct order.

If you don't want to get COBOL involved, another way to approach the problem is to start FUP and give it the command:

COPY <file>, <your process name>, blockout xxxxxx

where xxxxxx is some appropriate multiple of the file's record size. This will read the file with the same fast I/O library that COBOL uses, block the records into blocks xxxxxx bytes long, and write them to your process. Your process would open its $RECEIVE file and read the blocks from there. The blocks you get are simple fixed-length records laid out end-to-end, so deblocking is simple. As long as your program is not using its $RECEIVE for anything else and only needs to read one file at a time this way, this is a pretty simple approach. Since the data has to be sent from FUP to your process, that's an extra copy of the data and so is slower than the approach using COBOL, since there is only one user process involved with that approach, but in many cases, the extra data movement does not slow things down very much.

If the program is not going to process individual records from the file, then these approaches probably are not relevant. Since you didn't tell us the purpose of the program, we cannot tell you whether what you are doing is a good idea or a bad idea. If you want our opinion, and possibly other alternative suggestions, tell us what you are trying to accomplish and see what other suggestions we can give you.

Gustavo Martinez

unread,
Jul 31, 2013, 5:31:47 PM7/31/13
to
I would like to add the ELECTIONS parameter is not strictly needed to open a format 2 enscribe file.

FILE_OPEN_ return a File System Error 580 when the maximum size of a file is larger than 4 GB and the value of "elections" parameter does not permit 64-bit keys.

You can have a Format 2 file whose maximum EOF is less than 4 GB, and FILE_OPEN_ will not return 580 if you don´t use ELECTIONS.

If a file is larger than 4 GB, the ELECTIONS parameter must have a 1 in bit 31
for the open to progress.

francisco lopez Chile

unread,
Sep 2, 2013, 6:01:52 PM9/2/13
to
hello,
Can you tell me about the use of "ELECTIONS".

It does not work as I expected.

int32 elections = 1 ;
short options = 0x8000;
short nowait = 0;
short syncdepth = 1;
short erc;
short fnum = -2;

filename = "$ded.BCHILE.CRD01B";

erc = FILE_OPEN_(filename,
(short)strlen(filename),
&fnum,
ZSYS_VAL_OPENACC_READWRITE,
ZSYS_VAL_OPENEXCL_SHARED,
nowait,
syncdepth,
options,
/* sbb */
/* sbblen */
/* phandle */
elections);


FILE_GETINFO_(fnum, &ress );

printf( "Result %d \n ", ress );

SETMODE( filenum,141,0);

FILE_GETINFO_(fnum, &ress );

printf( "Result %d \n ", ress );

printf("hola \n ");

pc_block_bulk_buff = (char *) malloc(i_fblock_buff_data_len);

pc_bulk_buff = (char *) malloc(DEF_BULK_BUFF_SIZE);

if ((i_buff_data_len == 0) && (i_block_buff_data_len == 0)) {

printf ( "setea buffer en 000 \n");

memset(pc_bulk_buff, 0, DEF_BULK_BUFF_SIZE);

erc = READX(filenum,
pc_bulk_buff,
(short) DEF_BULK_BUFF_SIZE,
&i_bytes_read);

printf ( " BYTES LEIDOS %d \n ", i_bytes_read);


i_buff_data_len = (unsigned short) i_bytes_read;
printf ( " Registros leidos :%d \n", i_buff_data_len );
FILE_GETINFO_(filenum, &ress );

printf( "Result READ %d \n ", ress );
free(pc_bulk_buff);
free(pc_block_bulk_buff);

}

RESULT :

$DESA05 JEJEJE 131> run object
Result 580
Result 16
hola
setea buffer en 000
BYTES LEIDOS 0
Registros leidos :0
Result READ 16
$DESA05 REFRENEW 132>

Tone

unread,
Sep 2, 2013, 7:56:54 PM9/2/13
to
you are missing the commas for the parameters between options and elections.

options,
/* sbb */
/* sbblen */
/* phandle */
elections);


> El jueves, 20 de junio de 2013 12:41:23 UTC-4, francisco lopez Chile escribi�:
0 new messages