IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Finding length of VB/FB record size

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
View previous topic :: View next topic  
Author Message
sunnyk



Joined: 20 Oct 2004
Posts: 59

Posted: Mon Dec 13, 2004 6:00 pm    Post subject: Finding length of VB/FB record size  

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



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

Posted: Mon Dec 13, 2004 11:51 pm    Post subject:  

sunny,

Declare the first four bytes a different filed,

01 main-rec
05 first-four
05 remining
Back to top  
sunnyk



Joined: 20 Oct 2004
Posts: 59

Posted: Tue Dec 14, 2004 2:31 pm    Post subject:  

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



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

Posted: Wed Dec 15, 2004 1:06 am    Post subject:  

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



Joined: 30 May 2003
Posts: 1508

Posted: Wed Dec 15, 2004 5:59 am    Post subject:  

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



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

Posted: Wed Dec 15, 2004 11:46 am    Post subject:  

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  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM