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
 

 

Handling DSN features 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: Thu Oct 09, 2008 1:27 pm    Post subject: Handling DSN features dynamically...
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: 8593
Location: Back in jolly old England

PostPosted: Thu Oct 09, 2008 1:57 pm    Post subject:
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

Senior Member


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

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

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

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

Moderator Team Head


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

PostPosted: Thu Oct 09, 2008 2:22 pm    Post subject: Reply to: Handling DSN features dynamically...
Reply with quote

A few ideas:

http://www.ibmmainframes.com/viewtopic.php?t=24036&highlight=putenv
http://ibmmainframes.com/viewtopic.php?t=10746&highlight=putenv
http://www.ibmmainframes.com/viewtopic.php?t=9603&highlight=bpxwdyn
http://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    Post subject: Reply to: Handling DSN features dynamically...
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Oct 09, 2008 5:02 pm    Post subject:
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    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 how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm
No new posts PL/I: opening file w/ dynamically det... Sam Dodgers PL/I & Assembler 6 Wed Jul 27, 2016 4:05 pm
No new posts ON ERROR handling soundarr PL/I & Assembler 2 Wed May 11, 2016 3:37 am
No new posts Exception Handling in Native Stored P... Mariraj DB2 1 Thu Feb 25, 2016 4:08 am
No new posts Changing UID dynamically in ACF2 newroad CA Products 2 Sat Oct 31, 2015 1:17 am


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