Concatenate 15 GDG Base only if the versions exist



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

Concatenate 15 GDG Base only if the versions exist

Postby gyt3 » Sun Dec 30, 2012 10:17 am

I have 15 GDG Base , and some may have versions,whereas some may not have any GDG versions.

I want to copy all the versions created by 15 GDG base into a single file.It can be achieved by copying the GDG base like this,

step01 pgm=sort
sortin dd dsn=gdg1.base,disp-shr
.
.
=gdg15.base,disp=shr

sortout dd dsn=output dataset ,disp=(,catlg,)

But what will happen, if there are no versions created for one particular GDG base ?? will the job abend ?? If it abends, how can it be handled ?

Can anyone help me out in this ??
gyt3
 
Posts: 16
Joined: Sun Dec 16, 2012 9:58 am
Has thanked: 3 times
Been thanked: 0 time

Re: Concatenate 15 GDG Base only if the versions exist

Postby NicC » Sun Dec 30, 2012 2:57 pm

Why not set up some test gdg bases, create some generations on some of them and run sort?
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: Concatenate 15 GDG Base only if the versions exist

Postby gyt3 » Sun Dec 30, 2012 3:35 pm

the job abended with Jcl error.
gyt3
 
Posts: 16
Joined: Sun Dec 16, 2012 9:58 am
Has thanked: 3 times
Been thanked: 0 time

Re: Concatenate 15 GDG Base only if the versions exist

Postby steve-myers » Sun Dec 30, 2012 4:08 pm

gyt3 wrote:the job abended with Jcl error.
That is extremely unhelpful.
  • Show us the JCL.
  • Show us the output from a LISTCAT ENTRIES(GDG base) command.
Now suppose you have
xxx.G0001V00 -11
xxx.G0003V00 -10
xxx.G0005V00 -9
xxx.G0007V00 -8
xxx.G0008V00 -7
xxx.G0010V00 -6
xxx.G0011V00 -5
xxx.G0012V00 -4
xxx.G0015V00 -3
xxx.G0017V00 -2
xxx.G0018V00 -1
xxx.G0019V00 0

The relative generation is on the right, the absolute generation is on the left. Now, if you try relative generation -12 you will get a JCL error because there is no -12 generation. There is no issue with the missing data sets when you use relative generations in your JCL.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Concatenate 15 GDG Base only if the versions exist

Postby steve-myers » Sun Dec 30, 2012 5:35 pm

gyt3 wrote:the job abended with Jcl error.
A job cannot abend with a JCL error. It ended with a JCL error.

There are two distinct JCL errors:

IEFC452I jjjjjjjj - JOB NOT RUN - JCL ERROR

The system detected a JCL syntax error.

IEF453I jjjjjjjj - JOB FAILED - JCL ERROR

The system attempted to run the job, but it encountered a problem, usually some sort of data set error.

Both of these messages are in the JESMSGLG data set.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Concatenate 15 GDG Base only if the versions exist

Postby dick scherrer » Mon Dec 31, 2012 8:12 pm

Hello,

But what will happen, if there are no versions created for one particular GDG base ?? will the job abend ?? If it abends, how can it be handled ?

Can anyone help me out in this ??
When this process begins, catalog a new (empty) +1 Generation (NOT version). Then when your process runs that includes all active generations, there should be no problem. The process must be able to handle/skip a blank record.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Concatenate 15 GDG Base only if the versions exist

Postby steve-myers » Mon Dec 31, 2012 9:14 pm

I think gyt3 has a problem with terminology. The name of a data set in a generation data set group has three parts:
  • The name of the base of the generation data group, which we will say is BASE.
  • The generation, which we will say is gggg. The value for gggg always starts with 0001.
  • A version of the generation, which we will say is vv. The purpose of a "version" is to replace a defective previous version. The value for vv always starts at 00.
The true name of the data set is BASE.GggggVvv.

If there are no data sets in the generation data group, BASE(+1) will allocate BASE.G0001V00.

GDG data sets are normally named by their relative generation in JCL; if a GDG is used in JCL, the match between the relative generation and a true generation is fixed for the life of the job. So, if at the start of a job you have

BASE.G0101V00
BASE.G0102V01
BASE.G0103V00

BASE(0) is BASE.G0103V00
BASE(-1) is BASE.G0102V01
BASE(-2) is BASE.G0101V00
BASE(+1) is BASE.G0104V00 (for a new data set created in the job)
BASE(+2) is BASE.G0105V00 (for a new data set created in the job)

The use of relative generations should be avoided by services such as FTP and in TSO and by programs using dynamic allocation.

One defect in this scheme is it is not readily possible to detect obvious errors. For example, BASE(-3) does not exist, but it is not possible to bypass a step that wants to use BASE(-3). Similarly,

//A EXEC PGM=...
//NEW DD DISP=(NEW,CATLG),DSN=BASE(+1),...
//B EXEC PGM=...
//OLD DD DISP=OLD,DSN=BASE(-2)

will fail if the GDG base is defined to scratch data sets; step A will scratch G0101V00 when it creates G0104V00, so the data set is gone when step B tries to execute.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Concatenate 15 GDG Base only if the versions exist

Postby c62ap90 » Mon Dec 31, 2012 9:31 pm

But what will happen, if there are no versions created for one particular GDG base ?? will the job abend ?? If it abends, how can it be handled ?

Yes, job will abend if there are no version(s) created for a GDG base. It can be handled as follows:
Create a DUMMY +1 GDG (see example STEP001).
Use STEP010 to determine if any records in GDG's.
Use CONDition code to test if GDG's are empty (see example STEP020 and STEP030). You would put your 15-GDG copy in STEP020 (keep the COND statement).

//*  THIS STEP CREATES A DUMMY GDG SO THERE WILL BE AT LEAST 1 GDG     *
//*  TO AVOID JCL ERRORS (DATASET NOT FOUND).                          *
//*--------------------------------------------------------------------*
//STEP001 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUD   DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//FILEA    DD DUMMY,
//            DCB=BLKSIZE=80
//FILEB    DD DSN=TEST.EMPTY.FILE(+1),   - CREATES DUMMY GDG
//            DISP=(NEW,CATLG,DELETE),
//            …etc…
//SYSIN   DD *
   REPRO             -
     INFILE(FILEA)   -
     OUTFILE(FILEB)
//*
//*-----------------------------------------------------------------
//*--  PURPOSE: DETERMINE IF FILE IS EMPTY
//*--  NOTES:   - RETURN CODE = 0000 WHEN DSN HAS AT LEAST 1 RECORD
//*--             RETURN CODE = 0004 WHEN DSN HAS 0 RECORD {EMPTY}
//*-----------------------------------------------------------------
//STEP010  EXEC PGM=IDCAMS                                             
//SYSPRINT DD SYSOUT=*                                                 
//SYSUDUMP DD SYSOUT=*                                                 
//SYSOUD   DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//FILEA    DD DISP=SHR,DSN=TEST.EMPTY.FILE
//SYSIN    DD *                                                         
   PRINT  INFILE(FILEA) COUNT(1) HEX                                 
/*                                                                     
//*------------------------------------------------------------------
//STEP020  EXEC PGM=IDCAMS,COND=(0,NE,STEP010)
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUD   DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//FILEA    DD *
   THE FILE IS NOT EMPTY.
/*
//FILEB    DD SYSOUT=*
//SYSIN    DD *
   REPRO             -
     INFILE(FILEA)   -
     OUTFILE(FILEB)
/*
//*------------------------------------------------------------------
//STEP030  EXEC PGM=IDCAMS,COND=(0,EQ,STEP010)
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSOUD   DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//FILEA    DD *
   THE FILE IS     EMPTY.
/*
//FILEB    DD SYSOUT=*
//SYSIN    DD *
   REPRO             -
     INFILE(FILEA)   -
     OUTFILE(FILEB)
/*
//
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 7 times

Re: Concatenate 15 GDG Base only if the versions exist

Postby dick scherrer » Mon Dec 31, 2012 10:16 pm

Hello,

Yes, job will abend if there are no version(s) created for a GDG base.
Please Do Not propagate incorrect terminology. . .

To do what we believe TS wants to do (i.e. run with no job failure due to some missing generation(s)), there is no need to check for empty files. Unless someone posts a (good) reason why this needs to remain in the topic, i will delete my post and the previous suggestion.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Concatenate 15 GDG Base only if the versions exist

Postby c62ap90 » Mon Dec 31, 2012 10:34 pm

dick scherrer wrote:Hello,

Yes, job will abend if there are no version(s) created for a GDG base.
Please Do Not propagate incorrect terminology. . .

To do what we believe TS wants to do (i.e. run with no job failure due to some missing generation(s)), there is no need to check for empty files. Unless someone posts a (good) reason why this needs to remain in the topic, i will delete my post and the previous suggestion.

I think only the original poster can answer your question and no one else.
c62ap90
 
Posts: 125
Joined: Thu Oct 11, 2012 10:24 pm
Has thanked: 1 time
Been thanked: 7 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post