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
 

 

How to vary the FD division record length dynamically ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to vary the FD division record length dynamically ?
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: 6968
Location: porcelain throne

PostPosted: Sun Aug 31, 2008 6:36 pm    Post subject:
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: 6968
Location: porcelain throne

PostPosted: Sun Aug 31, 2008 6:41 pm    Post subject:
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    Post subject: Reply to: How to vary the FD division record length dynamica
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: 6968
Location: porcelain throne

PostPosted: Mon Sep 01, 2008 12:18 pm    Post subject:
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    Post subject: Reply to: How to vary the FD division record length dynamica
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    Post subject: Reply to: How to vary the FD division record length dynamica
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: 6968
Location: porcelain throne

PostPosted: Mon Sep 01, 2008 8:15 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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