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

Handling DSN features 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: Thu Oct 09, 2008 1:27 pm
Reply with quote

Hi Freinds,
I have a COBOL program which performs some common function. This will be used by many users. Because of that input and output file LRECL and other parameters will vary. I have heard about dynamic file creation in COBOL. It would be great if some one gives me the sample code. My JCL code look like this:

//ST01 EXEC PGM=VCTV
//SYSUT1 DD DSN=GU00059.TEST.FILE,DISP=SHR
//SYSUT2 DD DSN=GU00059.TEST.FILE.OUT,DISP=(,CATLG,DELETE),
// DCB=(LRECL=120,BLKSIZE=1200,RECFM=FB),
// SPACE=(TRK,(1,1),RLSE),UNIT=APLWK


Everytime the DSN Name, LRECL, SPACE, UNIT, BLKSIZE, DISP will vary depending on the requirement of the users. How to handle this ?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu Oct 09, 2008 1:57 pm
Reply with quote

Why not use VB records instead ? Then the universal code of

RECFM=VB,LRECL=27994

should always be valid.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Thu Oct 09, 2008 2:08 pm
Reply with quote

Not much I can add in..however code BLKSIZE=0 in the JCL & keep an eye on this thread..

ibmmainframes.com/viewtopic.php?t=34971
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Thu Oct 09, 2008 2:22 pm
Reply with quote

A few ideas:

www.ibmmainframes.com/viewtopic.php?t=24036&highlight=putenv
ibmmainframes.com/viewtopic.php?t=10746&highlight=putenv
www.ibmmainframes.com/viewtopic.php?t=9603&highlight=bpxwdyn
www.ibmmainframes.com/viewtopic.php?t=132&highlight=ikjtsoev
Back to top
View user's profile Send private message
dineshsjce
Currently Banned

New User


Joined: 16 Apr 2007
Posts: 41
Location: Bangalore

PostPosted: Thu Oct 09, 2008 4:52 pm
Reply with quote

Thanks Kevin, Anuj and Expat.

Kevin,
In all the above links dataset name and attributes are hardcoded. I did not get how to pass the dataset and other parameters from the JCL to the COBOL program.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Oct 09, 2008 5:02 pm
Reply with quote

First, if you're dealing with fixed length files what you want to do cannot be done in COBOL. It can be done, sort of, with variable length files as long as the COBOL file length is the longest possible length -- 27994 per expat's post -- but if the JCL doesn't have LRECL=27994 you're going to get file status 39 (file attribute mismatch).

Find the COBOL Language Reference in the manual link above and read section 4.2.3.1 on Assignment Name for Environment Variable. This is the only way in COBOL to use dynamic allocation of files.

COBOL isn't really designed for dynamic allocation. This is much more typically done in Assembler, but it's not easy there.

From your description of the requirements, you need to reconsider your language choice and perhaps use REXX instead -- or even ISPF dialogs. Dynamic allocation is easy in SAS, for example.
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 Dynamically pass table name to a sele... DB2 2
No new posts FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts File Handling COBOL Programming 9
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts SORT for dynamic trailer record + CSV... DFSORT/ICETOOL 14
Search our Forums:

Back to Top