IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Finding length of VB/FB record size


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Mon Dec 13, 2004 6:00 pm
Reply with quote

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
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Mon Dec 13, 2004 11:51 pm
Reply with quote

sunny,

Declare the first four bytes a different filed,

01 main-rec
05 first-four
05 remining
Back to top
View user's profile Send private message
sunnyk

New User


Joined: 20 Oct 2004
Posts: 59

PostPosted: Tue Dec 14, 2004 2:31 pm
Reply with quote

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
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Wed Dec 15, 2004 1:06 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Dec 15, 2004 5:59 am
Reply with quote

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
View user's profile Send private message
sandip_datta

Active User


Joined: 02 Dec 2003
Posts: 150
Location: Tokyo, Japan

PostPosted: Wed Dec 15, 2004 11:46 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Finding and researching jobs All Other Mainframe Topics 0
No new posts Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top