header sequence increment for every job run



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

header sequence increment for every job run

Postby sri222 » Tue May 27, 2014 12:02 pm

Hi,

I have added header and trailer in my jcl. In header i have mentioned a sequence number. intially i have mentioned it as 01. but i want to increment it using jcl for every job run. for example 1st job run the header should have sequence number 01 and for 2nd job run it should be 02 and for 3rd job run it should b3 03 in the output file like so on so.. i have tried to increment a particular number. but i want for every job run. this should be done through jcl only. my lrecl=80, blocksize=800. i have header in 1st positon. please help me
sri222
 
Posts: 2
Joined: Tue May 27, 2014 10:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: header sequence increment for every job run

 

Re: header sequence increment for every job run

Postby Aki88 » Tue May 27, 2014 12:47 pm

Hello,

When You say:
sri222 wrote:I have added header and trailer in my jcl. In header i have mentioned a sequence number.


Are you referring to JCL or an input file? You need to understand that JCL is just a medium through which programs are/can be executed, it doesn't contain File data of any form, rather it can contain instream data as input to various programs, or data sets which can be input or output to/from various programs, which can be triggered using a JCL.

Ignoring, the JCL part mentioned in your post, and only going by the understanding (which may be wrong) that you have an input file in which you want a count that needs to be updated on every run; a fairly simple solution would be to write a small COBOL program which:
1. Takes the input file (which has the count) you are referring to in your post as input.
2. Reads the count.
3. Does a +1 to the count.
4. Rewrites the updated count back in the file.

Please note, the above solution ignores a few things such as- an assumption is made that the input file contains only the current count of 'job runs' (since you haven't mentioned any more details about the input; if other data is present, it can be handled in the program basis the logic coded); second assumption, you do understand that JCL alone can not do any mathematical operation (AFAIK), and you'll need a program to do that for you; another assumption, what is the maximum projected value for your job runs or in simpler words, what is the maximum length of this count variable referred to.

sri222 wrote: i have tried to increment a particular number. but i want for every job run. this should be done through jcl only. my lrecl=80, blocksize=800. i have header in 1st positon. please help me


If you have already worked out a solution; please show us what you have done, and maybe we'll be able to guide you better.
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times

Re: header sequence increment for every job run

Postby sri222 » Tue May 27, 2014 2:10 pm

//STEP3 EXEC PGM=SORT
//SORTIN DD DSNAME=File1,DISP=SHR
//SORTOUT DD DSNAME=File2,DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=('00001',8:DATE=(4MD/)),
TRAILER1=(COUNT=(M11,LENGTH=3))
/*
//SYSOUT DD SYSOUT=*
//STEP4 EXEC PGM=SORT
//SORTIN DD DSNAME=File2,DISP=SHR
//SORTOUT DD DSNAME=File3,DISP=SHR
//SYSIN DD *
SORT FIELDS=COPY,
STOPAFT=1
INREC OVERLAY=(1:+1,ADD,1,5,ZD,EDIT=(TTTTT))
/*
//SYSOUT DD SYSOUT=*

File is input file which contains some data. file2 contains header and trailer information. file3 contains the increment of header value from position 1 to 5. but it is constant ie it contains the value 2 but iwant it to be updated with increment for every job run
sri222
 
Posts: 2
Joined: Tue May 27, 2014 10:27 am
Has thanked: 0 time
Been thanked: 0 time

Re: header sequence increment for every job run

Postby BillyBoyo » Tue May 27, 2014 2:18 pm

SORTIN is read, only, it is never written.

SORTOUT is written only, it is never read.

The way it would work is that on Day 1, the DSN for SORTIN would contain data for that days' run. On Day 2, the content of the DSN will be different. Logically, take the output from your second step (without the STOPAFT) and feed it in to your second step, producing different output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: header sequence increment for every job run

Postby NicC » Tue May 27, 2014 2:31 pm

Not a JCL question but a sort question - I assume DFSort. Topic moved to DFSort. If not DFSort let us know and it will be moved again.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: header sequence increment for every job run

Postby Aki88 » Tue May 27, 2014 3:02 pm

<Just a follow on to Nicc's post>

And in case if it is not DFSORT, but SYNCSORT, then a solution can be found here
Aki88
 
Posts: 371
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 35 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post