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

How to vary the FD division record length dynamically ?


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

New User


Joined: 16 Apr 2007
Posts: 41
Location: Bangalore

PostPosted: Sun Aug 31, 2008 6:08 pm
Reply with quote

Dear friends,

I have a COBOL program which does some common function. You can assume that as an UTILITY. It takes one input file, does some manipulation on data and generates an output file. My requirement is, anybody should be able to use this program as required. I have declared the FD division for both the I/P and O/P files as PIC X(200). But in the JCL the input file and the output file record length can be different (that depends on the users requirement). How can this be handled ? We know that FD division record length in the COBOL program and the record length in the JCL should be matching. Is there any method to solve this problem ??
Thanks in advance.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Aug 31, 2008 6:36 pm
Reply with quote

you will need to call the dynamic allocation routine, which means you will not have dd statements for your files.

do a search in the cobol forum for dynamic file allocation.

you will then need some kind of input file (or parm) to tell you the name and file attributes.

you can't do anything dynamic with a file if there is an fd/select and matching dd statements.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Aug 31, 2008 6:41 pm
Reply with quote

if you don't want to get into the dynamic allocation business in the cobol program, you could:

send any of the users files thru sort to lengthen the record length so that it is common record length -- that equals the FD/Select/DD statements.
then have a secondary file to tell you which routine to use with the input file.

if you have a file with 10 fields, and a second potential file with 15 fields, you will need code to address the 10 field file and separate code to deal with the 15 (or extra 5 fields).

depending upon what your utility is doing, you may want to invest some time learning DFSORT. or ezytrieve or sas, depending upon what your site has.

your requirements are tooooo generic. you can't easily code a fixed cobol module and at the same time be utlra generic.
Back to top
View user's profile Send private message
dineshsjce
Currently Banned

New User


Joined: 16 Apr 2007
Posts: 41
Location: Bangalore

PostPosted: Sun Aug 31, 2008 7:04 pm
Reply with quote

Thanks a lot Dick !!!. I will try with the second method, i.e to lengthen the file using some utility like SORT and covert it back.

But I have one doubt about the parameter passing thru procedures.

e.g , consider the current example where I need to pass 2 files (I/P and O/P)

//ST00 EXEC PROC=VCSVPGM,
// IN=GU00059.INPUT.FILE,OUT=GU00059.OUTPUT.FILE


If you look at the EXEC statement it is too lengthy. I may even have to pass the some other parameters like SPACE (primary and secondary) and UNIT etc.. for OUTPUT file. In that case it becomes too lengthy and it doesnt look good also. Is there any other method to pass these parameter in much simplified manner ?????
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 01, 2008 12:18 pm
Reply with quote

Thru a file or inline data. Iibm utilites use a dd named sysin, among others.
Back to top
View user's profile Send private message
GrantP

New User


Joined: 12 Aug 2008
Posts: 8
Location: Johannesburg

PostPosted: Mon Sep 01, 2008 5:49 pm
Reply with quote

If there are a known number of possible record layouts, you could use cobol's ability to process multiple record layouts in a similar fashion to the processing of header and trailer records at the beginning and end of a file.
ie multiple 01 levels within the same FD.
Back to top
View user's profile Send private message
dineshsjce
Currently Banned

New User


Joined: 16 Apr 2007
Posts: 41
Location: Bangalore

PostPosted: Mon Sep 01, 2008 6:13 pm
Reply with quote

Hi Dick,
Could u please give more info about "dynamic file allocation" ?. Pls mention the reference link if u have any. A sample code is also better. Thanks.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Sep 01, 2008 8:15 pm
Reply with quote

there are others here who will beable to guide you on this.

I alway use ibm utilities or one-off rexx's.

as far as I am concerned, dynamic allocation is just no fun to debug.
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 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
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top