Create Member



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Create Member

Postby Gustav » Wed May 06, 2020 2:06 pm

Hello everyone,

I am new in JCL, so that I have the following question and I hope anyone can answer this :?

I would like to create a new Member in a existing PDS per JCL (inspired by creating new pds in my library). So I wrote the following code to do:
-At first the existing Member is deleted.
-After that there must be my mistake.
...
//DELETE  EXEC PGM=IDCAMS                  
 //SYSPRINT DD  DUMMY                                            
 //SYSIN    DD  *                                                
 // DELETE ....TEST.Memlist(AUS)                              
 /*                                                              
 //*                                                              
 //STEP02 EXEC PGM=IEBGENER                                      
 //SYSUT1   DD DSN=&SYSUID..TEST.PDS,DISP=SHR                    
 //SYSUT2   DD DSN=&SYSUID..TEST.Memlist(AUS),DISP=SHR          
 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),                
 //            DISP=(NEW,CATLG,DELETE),                          
 //            UNIT=SYSDA,SPACE=(TRK,0)                         <=== 
 //SYSPRINT DD SYSOUT=*                                          
 //SYSIN DD DUMMY  

 

...

Something is incorrect apropos of the allocation of the space, which is marked with <===.

Thank you very much for your support :)

Gustav
Gustav
 
Posts: 7
Joined: Wed May 06, 2020 1:50 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Create Member

Postby NicC » Wed May 06, 2020 2:39 pm

1) use the code tags to present data - I have coded your post for you this time
2) Post your error messages so that we do not have to guess as to what your error is/are
3) You have DIsP=SHR for your output dataset but also NEW,CATLG,DELETE - which is it?
4) If you are creating the PDS then yu need space for it so TRK=0 is not going to work
5) That is not the correct syntax for IDCAMS
6) IDCAMS is not the way to delete a member of a PDS

I suggest that you look for JCL tutorials on the web and read the JCL and utilitiy manuals or, even better, get your manager to send you on a JCL course.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Create Member

Postby willy jensen » Wed May 06, 2020 3:01 pm

The step should look like the following since the target dataset exists. I am courious though, your inut dataset is called something.PDS, are you sure that it is a sequential dataset?
//STEP02 EXEC PGM=IEBGENER                                      
//SYSUT1   DD DSN=&SYSUID..TEST.PDS,DISP=SHR                    
//SYSUT2   DD DSN=&SYSUID..TEST.MEMLIST(AUS),DISP=SHR          
//SYSPRINT DD SYSOUT=*                                          
//SYSIN DD DUMMY  

And no need to delete the member beforehand, it will be overwritten if it exists.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Create Member

Postby Gustav » Wed May 06, 2020 3:32 pm

Hello,

thank you for your answer and sorry for my mistake. It might be the wrong term of using IDCAMS, but Step "Delete" does what it should do.
The request for the whole code is:
At first to delet it.
Then the same Member (AUS), with the same name("AUS") should be created again in the same library(MEMLIST) as before. The library Memlist is as library catalogized. (I hope you understand what I mean).

My Problem is: How to create a new Member in a existing library in JCL-Code.

A new library can be created per:


//*...                              
 //RESTART EXEC PGM=IEFBR14            /*delete pds*/      
 //ALT      DD DSN=&SYSUID..TEST.PDS,                                    
 //             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),                      
 //             DISP=(MOD,DELETE,DELETE),                                
 //             UNIT=SYSDA,SPACE=(TRK,(3,0,5))                          

//STEP01 EXEC PGM=IEFBR14                                              
 //NEU      DD DSN=&SYSUID..TEST.PDS,           /*create pds as library*/                        
 //             DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),                      
 //             DISP=(NEW,CATLG,DELETE),                                
 //             UNIT=SYSDA,SPACE=(TRK,(3,0,5))                          
 







This is the code, where I want to create my member:



//*...                                                    
 //DELETE  EXEC PGM=IDCAMS                                              
 //SYSPRINT DD  DUMMY                                                    
 //SYSIN    DD  *                                                        
   DELETE ....TEST.MEMlist(AUS)                                      
 /*                                                                      
 //*                                                                    
 //STEP02 EXEC PGM=IEBGENER                                              
 //SYSUT1   DD DSN=&SYSUID..TEST.PDs,DISP=SHR                            
 //SYSUT2   DD DSN=&SYSUID..TEST.Memlist(AUS),                          
 //            DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),                        
 //            DISP=(NEW,CATLG,DELETE),                                  
 //            UNIT=SYSDA,SPACE=(TRK,(3,0,5)) /*here is the mistake*/                       
 //SYSPRINT DD SYSOUT=*                                                  
 //SYSIN DD DUMMY                                                        
 //*...
 



and here the compiler output:


IGD17101I DATA SET AP5U2.TEST.PDS2                    
NOT DEFINED BECAUSE DUPLICATE NAME EXISTS IN CATALOG  
RETURN CODE IS 8 REASON CODE IS 38 IGG0CLEH          
IEF272I .....  STEP02 - STEP WAS NOT EXECUTED.                                  
IEF285I   ...........JOB26885.D000000A.?             SYSOUT                  
IGD104I AP5U2.TEST.PDS                               RETAINED,  DDNAME=SYSUT1  

 


Thank you very much for your help!
Gustav
 
Posts: 7
Joined: Wed May 06, 2020 1:50 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Create Member

Postby willy jensen » Wed May 06, 2020 3:39 pm

As NicC already has pointed out you do not use DISP=(NEW,CATLG) for a dataset which exists, you use DISP=SHR (or OLD) as in my sample.
And I must repeat, even though the IDCAMS step does delete the member, it is unneccessary as the DSN=lib(member) will just replace any existing member.

These users thanked the author willy jensen for the post:
Gustav (Wed May 06, 2020 5:07 pm)
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Create Member

Postby NicC » Wed May 06, 2020 4:05 pm

Your output shows that your delete did not work - you should check the return code to see if the next step should be executed. You should also post the JES log of the execution as this contains pertinent information not just for the copy step but also the delete and define steps.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic

These users thanked the author NicC for the post:
Gustav (Wed May 06, 2020 5:07 pm)
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Create Member

Postby Gustav » Wed May 06, 2020 4:54 pm

It was hardly to understand that I dont have to initialize anything to create the member, when the library ist already initialize. But now it works (also with the "delete" :mrgreen: )

Thany you guys!!! :D
Gustav
 
Posts: 7
Joined: Wed May 06, 2020 1:50 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Create Member

Postby steve-myers » Wed May 06, 2020 5:05 pm

It's more complex than Nic suggests. You are mixed up about the idea of creating a data set and creating a member within a partitioned data set.

As Mr Jensen already said, twice (I think), you do not need to delete a member of a partitioned data set before replacing the member. Only the Binder program cares about this issue, and you are not using the Binder here. Forget the IDCAMS step.

With a DD statement like this -
//SYSUT2   DD  DISP=(NEW,CATLG),
//             UNIT=SYSDA,
//             SPACE=(TRK,(1,0,3)),
//             DCB=(RECFM=FB,LRECL=80),
//             DSN=dataset(member)

you are doing 2 things.
  1. You are telling the system to create a data set named dataset in this JCL
  2. You are telling the system to create a member - member - in the data set when the program uses the data set.
These are two distinct things, combined into one.

Now if the data set already exists, to create, or replace, a member within the data set you only need JCL like this.
//SYSUT2   DD  DISP=OLD,
//             DSN=dataset(member)

These users thanked the author steve-myers for the post:
Gustav (Wed May 06, 2020 5:07 pm)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Create Member

Postby Gustav » Wed May 06, 2020 5:10 pm

@steve-myers: That is exactly what I haven't got before. Thank you for your summary :!: .
Gustav
 
Posts: 7
Joined: Wed May 06, 2020 1:50 pm
Has thanked: 4 times
Been thanked: 0 time

Re: Create Member

Postby steve-myers » Thu May 07, 2020 12:29 am

I created this JCL example for you. Except for the use of &SYSUID in the data set name it would have worked 52 years ago!
//A       EXEC PGM=IEFBR14
//GUSTAV   DD  DISP=(MOD,DELETE),UNIT=SYSDA,SPACE=(TRK,0),
//             DSN=&SYSUID..GUSTAV.DATA(GUSTAV)
//B       EXEC PGM=IEFBR14
//GUSTAV   DD  DISP=(NEW,CATLG),UNIT=SYSDA,SPACE=(TRK,(1,1,1)),
//             DCB=(RECFM=FB,LRECL=80),
//             DSN=*.A.GUSTAV
//C       EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//SYSUT2   DD  DISP=OLD,
//             DSN=*.A.GUSTAV
//SYSUT1   DD  *
THIS IS MEMBER GUSTAV

In some ways the DD statement with DD name GUSTAV in the job step with step ID A is the trickiest part of the JCL. Surprisingly it is also the most dangerous JCL statement in the job.

DISP=(MOD,...) tells the system to determine if the data set exists in the catalog. If it does, use the catalog data to allocate the data set. If the data set does not exist in the catalog, use the data in the UNIT and SPACE keywords to allocate and subsequently delete the data set. It is dangerous because if the data set is allocated on a tape the system would attempt to load the tape.

The IEFBR14 program, which existed 52 years ago but was seldom used - few of us (and I was not one of them, in fact I didn't know it existed!) really understood its value - is about the simplest possible program. In C it would look like this -
int iefbr14( NULL )
 {
  return 0;
 }


So, step A deletes the data set, if it existed when the job started.

Step B creates the data set. After the step completes, there is no member in the data set, as IEFBR14 writes nothing to the data set.

The IEBGENER program in step C created member GUSTAV in data set userid.GUSTAV.DATA. As proof, I used ISPF to see what is in the data set -
BROWSE    XXXXXX.GUSTAV.DATA                                Row 00001 of 00001
Command ===>                                                  Scroll ===> PAGE
   Name     Prompt          Size    Created           Changed            ID  
. GUSTAV
  **End**

and
BROWSE    XXXXXX.GUSTAV.DATA(GUSTAV)                 Line 00000000 Col 001 080
 Command ===>                                                  Scroll ===> PAGE
********************************* Top of Data **********************************
THIS IS MEMBER GUSTAV
******************************** Bottom of Data ********************************

The DSN=*.A.GUSTAV in steps B and C refers to the data set as it is specified in the JCL in step A; this includes the member name.

The order of the DD statements in step C seems unusual today, but 52 years ago the more commonly used versions of OS/360 required that any DD statement that defined a data set within the job stream had to be the last DD statement in the job step, so this way of writing the JCL was common.

It is difficult to understand these days how fluid things were in the early days of mainframes. Seemingly every day something new and useful was available, or something that worked yesterday didn't work today. Well, it wasn't really quite that fluid, but that gives you the idea how exciting things were!

These users thanked the author steve-myers for the post:
Gustav (Thu May 07, 2020 11:50 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post