'RECORDING V' file problem



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

'RECORDING V' file problem

Postby ElHachu » Mon Feb 14, 2011 1:10 pm

Hi all,

I'm testing an Enterprise Cobol program with an variable length input file. Its register is defined in File Section as PIC X(3600), and the file has physical lrec of 3604.

When I submit the job I obtain a file status 4 (error with the lrec).

I think you should know this program was written and compiled as Cobol, but now the client is migrating to Enterprise Cobol. Can this be the problem?

I post the FD

FD MYFILE RECORDING V
LABEL RECORD STANDARD
BLOCK CONTAINS 0 RECORDS.
01 REG-MYFILE PIC X(3600).

These are the file attributes: Dsorg=PS Recfm=VB Lrecl=3604


Thank you in advance for all your time and help.
ElHachu
 
Posts: 3
Joined: Mon Feb 14, 2011 12:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: 'RECORDING V' file problem

Postby Robert Sample » Mon Feb 14, 2011 3:47 pm

A file status 04 does not mean you have a problem with the LRECL. A file status 04 means you attempted to read a record (which worked) but you do not have any 01 under the FD that has the length of the record just read. There is something (record type variable or occurrences / length variable) that tells how long each of the variable length records is. If it is a record type, you need one 01 for each record type with the length of that record type. If it is an occurrences / length indicator, you need to change your FILLER PIC X(3600) to describe the record at least through the OCCURS DEPENDING ON clause so the 01 is not a fixed length record (which you have defined it to be).

These users thanked the author Robert Sample for the post:
marcello_mco (Thu Sep 30, 2021 11:40 pm)
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: 'RECORDING V' file problem

Postby ElHachu » Mon Feb 14, 2011 4:02 pm

Thank you for your answer Robert.

I think it may be the first option you say (occurrences / length indicator).

When I read the file, I read it into a 01 level with 57 positions (in lower levels). I don't know why we use a 3604 lrec file, but it is not in my hand to change this and many processes would be affected.

Do you think that if I add a filler until completing the 3604 positions it would work?

Thank you again.
ElHachu
 
Posts: 3
Joined: Mon Feb 14, 2011 12:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: 'RECORDING V' file problem

Postby ElHachu » Mon Feb 14, 2011 4:09 pm

Robert, I think I found the solution. Excuse me, YOU found the solucion. You were right. Thank you so much.
ElHachu
 
Posts: 3
Joined: Mon Feb 14, 2011 12:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: 'RECORDING V' file problem

Postby Robert Sample » Mon Feb 14, 2011 5:42 pm

The 3604 is because a variable length file requires a way to identify how long each record is. IBM determined, many many many years ago, to use a 4-byte prefix on each record. The first two bytes of the prefix have the record length and the second two bytes are reserved. Hence if your COBOL program has a maximum length of 3600 for a variable length record, the LRECL will be 3604. The block size must be at least 3608 (there's a 4-byte block length prefix for each block since the block length needs to be kept somewhere, too).
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post