Mapping file variable



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

Mapping file variable

Postby vegafacundodaniel » Fri Nov 06, 2015 1:57 pm

Hello to all,

Could anyone tell me how can I mapping a variable file with a copybook?

If I see the dataset in ISPF I don't see the first 4 characters of the length.

Thanks in advance
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Mapping file variable

 

Re: Mapping file variable

Postby BillyBoyo » Fri Nov 06, 2015 2:23 pm

The first four bytes of a variable-length record are the Record Descriptor Word. Except for the unlikely case of you having an "S-type" variable-length record to look at, the first two bytes, taken as signed binary, indicate the length and the next two bytes you can ignore. From ISPF you can always tell the length of a record by finding the position of the last byte (put the cursor on the last position, move to the right (often PF11), look at the screen).

Or do you mean something else? If so, you'll have to be much clearer, and give sample input and required output and what you are currently receiving.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Mapping file variable

Postby vegafacundodaniel » Fri Nov 06, 2015 2:40 pm

Thanks for your reponse.
I'd like to see the content of the Record Descriptor Word. Can I ? How?
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Mapping file variable

Postby BillyBoyo » Fri Nov 06, 2015 2:57 pm

OK, but why? Except for a RECFM=VS or RECFM=VBS it is very uninteresting and contains exactly the information you can intuit from the display of the record in ISPF?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Mapping file variable

Postby vegafacundodaniel » Fri Nov 06, 2015 3:10 pm

I need to see that information because I am sure if my program est OK. I don't know if I have to define a first field of the file in my cobol program with PIC S9(4) COMP or not.That is the raison.

My description file in the program is
BLOCK 0 RECORDS
RECORDING MODE V
RECORD IS VARYING IN SIZE FROM 1 TO 300 CHARACTERS
DEPENDING ON VAR-SIZE
LABEL RECORD ARE STANDARD.


and in my JCL is:
FILEAUT DSN=CYTT21.GAASGG.FILEAUT,DISP=(,CATLG),
UNIT=3390,SPACE=(TRK,(50,10),RLSE),
DCB=(RECFM=VB,LRECL=304,BLKSIZE=0)

Thanks
vegafacundodaniel
 
Posts: 61
Joined: Tue Jul 20, 2010 4:27 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Mapping file variable

Postby BillyBoyo » Fri Nov 06, 2015 4:23 pm

You don't need to code the RDW under the FD. Your VAR-SIZE will contain the length, COBOL will populate that when a record is read, and use what is in that field when a record is written. VAR-SIZE is a silly, meaningless, name so I hope it is only that for this example.

In IBM COBOL, the RDW is hidden from you because how records are stored on any given system is not part of the COBOL Standard, it is an implementation issue, and entirely separate from the COBOL language.

In Linux/Unix/Windows there is no concept of an "RDW". A variable-length record would have a record-delimiter. The idea is that your program would still work the same, and you don't need to know anything about a different underlying file-system.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: Mapping file variable

Postby NicC » Fri Nov 06, 2015 4:27 pm

And there is no other program that you can look at to see how it declares a variable length record dataset?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post