Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Variable Record Length ESDS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Mon Sep 07, 2009 8:42 am    Post subject: Variable Record Length ESDS
Reply with quote

Hi,

I have a Variable record length ESDS whose length may vary from 1 to 1300. Now i need to read the file sequentially in Cobol(batch program). After reading the record, depending on the some condition i write the same record to another file(length same as input record) or change a field(change the length) and then write to another ESDS file. How can i achieve this? Can i know the Record length of each record read using RBA?

Ganesh
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8121
Location: East Dubuque, Illinois, USA

PostPosted: Mon Sep 07, 2009 9:27 am    Post subject:
Reply with quote

Quote:
How can i achieve this? Can i know the Record length of each record read using RBA?
I don't know of any way in COBOL to know this -- you don't really have access to the RBA in COBOL.

But, you don't need it. Go to the manuals link at the top of the page, find the COBOL Language Reference manual, and read section 5.2.5.3 on the RECORD CONTAINS clause of the FILE SECTION. When this is used, COBOL will set a numeric variable to have the length of each record as you read it. This works for sequential as well as VSAM file, so there's no reference to the RBA required. It also works for output files.

Sometimes you limit your responses by attempting to restrict things too much in the problem statement. If you have to know the RBA, you cannot do what you want in COBOL If you don't care about the RBA but just want the record length, it can easily be done.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Sep 07, 2009 5:11 pm    Post subject:
Reply with quote

If 'am not mistaken, this
Quote:
After reading the record, depending on the some condition i write the same record to another file(length same as input record) or change a field(change the length) and then write to another ESDS file.
is your problem statement. If yes, why at all RBA is a concern here?
Back to top
View user's profile Send private message
ganeshprasanna

New User


Joined: 21 Feb 2009
Posts: 36
Location: South Portland, Maine

PostPosted: Tue Sep 08, 2009 9:22 am    Post subject:
Reply with quote

Thanks Robert & Anuj.

My concern is with respect to the file structure, as the record may have any of the many defined variable layouts(there are 26 layouts a record might fit into). Is there a way by which i just have to write the input to output file without moving to any of the layouts?

ex: Record 1 -> Can be of layout 3(record length = 123)
Record 2 -> Can be of layout 5(record length = 234)

Now, can i write these records to output file without moving it into any file record layouts, but keeping the record length same in the output?.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8121
Location: East Dubuque, Illinois, USA

PostPosted: Tue Sep 08, 2009 2:57 pm    Post subject:
Reply with quote

Use the RECORD CONTAINS clause on both input and output file, set the output file length from the input file length, and write the record of the correct length. You don't need to define each possible layout -- use an 01 that has an 05 with OCCURS DEPENDING ON so the correct record length is used.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Sep 09, 2009 12:39 am    Post subject:
Reply with quote

Hello,

If your file is variable length but the data is in multiple fixed format records, i suspect there is some record-id or layout-code in each record.

The programs that currently process this data probably use this to determine which part of the code to execute.

Suggest you do the same in this program. It this requires 26 output formats, so be it. If the records do not already use ODO (Occurs Depending On), you may add confusion.

So far, there has not been a very clear description of just what is needed. . . icon_confused.gif

It may also be that i'm just slower than usual today icon_wink.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am
No new posts Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us