View previous topic :: View next topic
|
Author |
Message |
sunnyk
New User
Joined: 20 Oct 2004 Posts: 59
|
|
|
|
Hi all,
Can anyone tell me how to find the length of each record in a variable length record or in a fixed length record in a cobol program?
Can we do it thru reference modification by checking first 4 chars of each individual record of the output dataset( of JCL) in the COBOL pgm(for VB records)?
If there is some simple and straight answer( for both FB and VB), do let me know.
Thanx
Sunny |
|
Back to top |
|
|
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 160 Location: Toronto, Canada
|
|
|
|
sunny,
Declare the first four bytes a different filed,
01 main-rec
05 first-four
05 remining |
|
Back to top |
|
|
sunnyk
New User
Joined: 20 Oct 2004 Posts: 59
|
|
|
|
Hi masade,
What u said is the case for VB which i think i suggested in my question itself.
I am asking for finding the length of FB too.
Is there any other method to find the length of records of VB format???
thanks for ur quick response masade...hope u give me some good suggestion.
Thanx
sunny |
|
Back to top |
|
|
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 160 Location: Toronto, Canada
|
|
|
|
Sunny,
I am sorry, I didn't pay attention while answering.
you want to know the length of a FB. does that mean you want to find out how many characters of data is present.
01 ws01-Name pic x(20) value 'ABCDE'.
in the above you want to say the length is 5? or 20?
if you want complete record length, you can use Length of
ws-length = Length of ws01-name. this gives you the value 20 |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Sunny,
Here's another approach for V/VB recs. Syntax is approximate since I don't have a manual handy.
In the FD code: RECORD VARYING FROM x TO y DEPENDING ON
WS-REC-LEN
Define WS-REC-LEN as 9(005) (think it can be COMP or COMP-3; vaguely remember can't have sign.)
Read a rec. WS-REC-LEN will contain the length of the rec just read. If you want to write the rec to an OP file, define it with the VARYING/DEPENDING ON too. If you want to change the length just move the new len to WS-REC-LEN (or the OPs own field) before you do the WRITE.
The only way to get the len of a F/FB rec is to follow the cntl block chain to the DCB or write an assembler pgm annnd issue a RDJFCB macro. |
|
Back to top |
|
|
sandip_datta
Active User
Joined: 02 Dec 2003 Posts: 150 Location: Tokyo, Japan
|
|
|
|
Hi Sunny,
RDW contains the record length of a VB record. You can use following job to get the length of individual record in VB File. I got this solution from one of the gods of mainframe world.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... VBS input file
//SHOW DD SYSOUT=*
//TOOLIN DD *
DISPLAY FROM(IN) LIST(SHOW) ON(VLEN) BLANK
/*
|
regards,
Sandip. |
|
Back to top |
|
|
|