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
 

 

create a GDG generation with setenv?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Thu Apr 21, 2011 7:27 pm    Post subject: create a GDG generation with setenv?
Reply with quote

If I have created a GDG base, can I create the next GDG generation in a COBOL program using setenv?

I tried it but was getting errors and could not get it to work. Part of the problem is I am not sure what the syntax should be for the ENV-VALUE passed into setenv. It didn't seem to like the +1 in the DSN or the DCB parameters.

Will I need to use IKJEFTSR and execute a TSO ALLOCATE commmand instead?

Also, a side note -
Is BPXWDYN only available to use if Unix Services are turned on? And which is the cleanest, most efficient way to allocate files? setenv, TSO command, or BPXWDYN?
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 Apr 21, 2011 8:21 pm    Post subject: Reply to: create a GDG generation with setenv?
Reply with quote

Creating a relative generation (i.e. using a +1 instead of an actual explicit dataset name) is only possible in batch, by using BPXWDYN, or by calling actual JES enqueue and dequeue macros that I personally don't know much about. I don't know what sentenv is or what it does.

As far as I'm concerned, it's a tossup between using the standard TSO ALLOC command that we've all used forever, or BPXWDYN, which can be used in other langauges as well (I've used it in REXX execs a lot).
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Fri Apr 22, 2011 12:20 am    Post subject:
Reply with quote

i have resolved this. I was able to use setenv
Back to top
View user's profile Send private message
jasorn

Active User


Joined: 12 Jul 2006
Posts: 153
Location: USA

PostPosted: Fri Apr 29, 2011 8:01 pm    Post subject:
Reply with quote

Susan Talbot wrote:
i have resolved this. I was able to use setenv

Can you post some example code for others' benefit?
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Fri Apr 29, 2011 8:39 pm    Post subject: Reply to: create a GDG generation with setenv?
Reply with quote

Sure! In my JCL I am passing in the name of the file and the SPACE (PRIMARY, SECONDARY)

This is passed in via PARM=
Code:

//STEP002 EXEC PGM=MYPGM,                                           
//PARM='TEST.GDG.FOR.TEST.PROGRAM(+1)00050005'


In the program

Code:

FILE-CONTROL.                         
    SELECT CARD-OUT ASSIGN TO PRINT   
           ORGANIZATION IS SEQUENTIAL 
           ACCESS MODE IS SEQUENTIAL   
           FILE STATUS PRINT-STAT.     

DATA DIVISION.                               
FILE SECTION.                               
FD  CARD-OUT                                 
    RECORDING MODE   F                       
    LABEL RECORDS  ARE STANDARD             
    BLOCK CONTAINS   0 RECORDS               
    RECORD CONTAINS 80 CHARACTERS.           
01  FILE-RECORD                  PIC X(80). 

WORKING-STORAGE SECTION.                   
01 PRINT-STAT                    PIC 99.   
01 WS-SIZE                       PIC 9(9).

01 ENV-VARS.                                             
   05 ENV-NAME                   PIC X(9).               
   05 ENV-VALUE                  PIC X(100).             
   05 ENV-OVERWRITE          PIC S9(8) COMP.         
   05 ENV-RC                       PIC 9(9) BINARY.       


LINKAGE SECTION.                                   
01 PARM-AREA.                                       
   05  SYSIN-FILE-ID                 PIC X(31).
   05 WS-PRIMARY                    PIC 9(4).
   05 WS-SECOND                     PIC 9(4).


PROCEDURE DIVISION.
PERFORM 2000-CREATE-FILE
PERFORM 2500-OPEN-FILE 

  2000-CREATE-FILE.                                                                                                     
      MOVE z'PRINT' TO ENV-NAME.                                   
      STRING ' DSN('                                               
              SYSIN-FILE-ID                                         
             '),NEW,CYL,SPACE(' WS-PRIMARY ',' WS-SECOND '),UNIT(SY
 -           'SDA),CATALOG' Delimited By Size                       
      Into ENV-VALUE.                                               
      DISPLAY 'ENV-VALUE = ' ENV-VALUE                             
      MOVE 1 TO ENV-OVERWRITE.                                     
      CALL "setenv" USING ENV-NAME, ENV-VALUE, ENV-OVERWRITE       
      RETURNING ENV-RC.                                             
      DISPLAY 'ENV-RC = ' ENV-RC                                   
                                                                   
      IF ENV-RC = 0                                                 
         PERFORM 2500-OPEN-FILE                                     
      ELSE                                                         
         PERFORM 8000-FILE-ERROR                                   
      END-IF.               

     
  2500-OPEN-FILE.                     
                                     
       OPEN OUTPUT CARD-OUT           
                                     
       IF PRINT-STAT NOT = 00         
          PERFORM 8500-OPEN-ERROR.   


                                 


I created the GDG Base an Model outside of this program.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1714
Location: UK

PostPosted: Fri Apr 29, 2011 10:39 pm    Post subject:
Reply with quote

Just looked up SETENV on Google - it is a *nix thing - not mainframe.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7909
Location: Bellevue, IA

PostPosted: Fri Apr 29, 2011 11:45 pm    Post subject:
Reply with quote

SETENV may be a *nix thing, but environment variables come right out of the COBOL Language Reference manual:
Quote:
4.2.3.2 Environment variable contents for a QSAM file



For a QSAM file, the environment variable must contain either a DSN or a PATH option in the format shown below.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Sat Apr 30, 2011 12:03 am    Post subject:
Reply with quote

Nic Clouston wrote:
Just looked up SETENV on Google - it is a *nix thing - not mainframe.

Remember, though, that Unix -- and perhaps some other *nices -- runs under z/OS on the mainframe. I think that setenv is IBM's recommended method of doing dynamic file allocations in Enterprise COBOL.
Back to top
View user's profile Send private message
mambopras

New User


Joined: 11 Nov 2008
Posts: 52
Location: Hyderabad

PostPosted: Sun May 15, 2011 2:02 pm    Post subject: RE :create a GDG generation with setenv?
Reply with quote

What does the [b] signify in the STRING function used in the program ?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sun May 15, 2011 2:26 pm    Post subject: Reply to: create a GDG generation with setenv?
Reply with quote

it' s a mix up of tags
Code:
[b]something  [/b]

something

ibmmainframe.com does not honor nested tags inside the <code> tages
Back to top
View user's profile Send private message
Susan Talbot

New User


Joined: 17 Dec 2010
Posts: 36
Location: KY

PostPosted: Mon May 16, 2011 7:41 am    Post subject: Reply to: create a GDG generation with setenv?
Reply with quote

yes please ignore the b tag
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
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm
No new posts Need to create file with Dynamic Name... kapil27 JCL & VSAM 4 Wed May 25, 2016 9:45 am
No new posts alphanumeric sequence generation sivaprasad.gadhi COBOL Programming 6 Wed Mar 30, 2016 3:03 am


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