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

Variable Record Length ESDS


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 07, 2009 9:27 am
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

Superior Member


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

PostPosted: Mon Sep 07, 2009 5:11 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 08, 2009 2:57 pm
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

Moderator Emeritus


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

PostPosted: Wed Sep 09, 2009 12:39 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top