Page 1 of 2

How to concatenate records from two ps into one ps?

Posted: Tue Jun 16, 2009 10:27 am
by nidhi1985
I have two ps in which:

One is having records like name of files in 1-20 columns and LRECL of the file is 80 and RECFM is FB.

Another one is having records like date when each file was processed in 1-20 columns and LRECL of the file is 80 and RECFM is FB.

I want to concatenate the records in two files in such a way that the name and the date in which that file was processed will come in same record.

as for example:

PS1:
uytreh.ijhdftg.gtyhkmn
retghb.iuhhhh.uhuhuhh
huhjhh.ujhjhju.uhjjhjhj

PS2:
2009-05-062009-09-05
2009-04-072009-02-06
2008-10-272009-04-12

Output:
uytreh.ijhdftg.gtyhkmn 2009-05-062009-09-05
retghb.iuhhhh.uhuhuhh 2009-04-072009-02-06
huhjhh.ujhjhju.uhjjhjhj 2008-10-272009-04-12

And I want to do all this using jcl utilities or dfsort.
The output file can be a new file or this can be modified in an old file.

Please give me some solution

Posted: Tue Jun 16, 2009 4:56 pm
by Shashank Gite
I don't think you can do it using only jcl utilities or sort. You will have to write a small application program because you are merging two saparate records from different files into a single record.
If you find such solution than please let me know at my mail
Shashank.Gite@Steria.co.in

Posted: Wed Jun 17, 2009 6:41 am
by skolusu
Concatenate both files together and using group function we can push the first record of first file on to the first record of second file.

You mentioned that second file only has only dates , so it is always numeric and the first file is dataset names and you cant have a numeric in them. So we check that and pad a seqnum to match. The dataset names can be a max of 44 bytes , so we put the dates in pos 46 of the output file

Code: Select all

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                
UYTREH.IJHDFTG.GTYHKMN                                         
RETGHB.IUHHHH.UHUHUHH                                          
HUHJHH.UJHJHJU.UHJJHJHJ                                        
//         DD *                                                
2009-05-062009-09-05                                           
2009-04-072009-02-06                                           
2008-10-272009-04-12                                           
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1',SEQNUM,8,ZD)),      
  IFTHEN=(WHEN=(1,1,SS,EQ,C'1234567890'),                      
  OVERLAY=(46:1,20,01:45X,81:C'2',SEQNUM,8,ZD,RESTART=(81,1))) 
  SORT FIELDS=(82,8,CH,A),EQUALS                               
                                                               
  OUTREC IFTHEN=(WHEN=GROUP,RECORDS=2,PUSH=(1:1,45))           
                                                               
  OUTFIL BUILD=(1,80),OMIT=(81,1,ZD,EQ,1)                      
/*                                                             


The following is the output from the job

Code: Select all

UYTREH.IJHDFTG.GTYHKMN                       2009-05-062009-09-05
RETGHB.IUHHHH.UHUHUHH                        2009-04-072009-02-06
HUHJHH.UJHJHJU.UHJJHJHJ                      2008-10-272009-04-12

Thanx skolusu

Posted: Wed Jun 17, 2009 1:34 pm
by nidhi1985
But the problem is that I don't have a fixed number of records in the file, it changes as per the files included in a cycle.
The only thing that is fixed is that both the files will have same number of records.
I think you got what I mean.
You can use icetool also but I don't want to use any programming language.
Please reply as soon as possible.
Its urgent.

Re: Thanx skolusu

Posted: Wed Jun 17, 2009 8:53 pm
by skolusu
nidhi1985 wrote:But the problem is that I don't have a fixed number of records in the file, it changes as per the files included in a cycle.
The only thing that is fixed is that both the files will have same number of records.
I think you got what I mean.
You can use icetool also but I don't want to use any programming language.
Please reply as soon as possible.
Its urgent.
nidhi1985,

what makes you think that my solution will NOT handle it ? Did you even run and see if it works?

Thanx skolusu

Posted: Thu Jun 18, 2009 12:19 pm
by nidhi1985
I will definitely try this

Thanx Skolusu,

Posted: Thu Jun 18, 2009 12:44 pm
by nidhi1985
The second file has only the names but the names are as such IHM.CXDTRN1.TRNSFR, so what I mean to say is that the file names too have numbers in them

And one more thing:
Can I mention the name of two files that I am using instead of copying data from them in SORTIN statement as:
//SORTIN1 DD DSN=dsn name1, DISP=shr
//SORTIN2 DD DSN=dsn name2, DISP=shr

Please clear up my doubts as I am not able to understand the full code.

Posted: Thu Jun 18, 2009 8:53 pm
by skolusu
nidhi1985 wrote:The second file has only the names but the names are as such IHM.CXDTRN1.TRNSFR, so what I mean to say is that the file names too have numbers in them
It doesn't matter , as long as they are mainframe dataset names, the first alphabet can never be a number and I am only checking the first byte to see if it is a number


nidhi1985 wrote:And one more thing:
Can I mention the name of two files that I am using instead of copying data from them in SORTIN statement as:
//SORTIN1 DD DSN=dsn name1, DISP=shr
//SORTIN2 DD DSN=dsn name2, DISP=shr
If you read my post clearly you should have found this
Concatenate both files together and using group function we can push the first record of first file on to the first record of second file.
ie.

Code: Select all

//SORTIN   DD DSN=your file with dataset names,DISP=SHR
//         DD DSN=your file with numerical dates,DISP=SHR

For complete details on the new WHEN=GROUP and the other new functions available with PTF UK90013, see:

www.ibm.com/systems/support/storage/sof ... /mvs/ugpf/

Posted: Fri Jun 19, 2009 5:05 pm
by nidhi1985
Thanks

Posted: Fri Jun 19, 2009 5:07 pm
by nidhi1985
Thanks 4 clearing up my doubts

hi skolusu

Posted: Fri Jun 19, 2009 5:15 pm
by nidhi1985
Thanks for ur support

Hi skolusu

Posted: Mon Jun 22, 2009 11:20 am
by nidhi1985
I tried that jcl but
while doing a jjscan its giving me an error of severity 8
and that is
Parameter keyword records unidentified
Parameter keyword push unidentified

Please advice me what to do in this situation

Posted: Mon Jun 22, 2009 1:17 pm
by maheshvamsi
Could you please post JCL & Errors. So that it will be easy for everyone to check

Posted: Mon Jun 22, 2009 4:22 pm
by Anuj Dhawan
Parameter keyword records unidentified
Parameter keyword push unidentified
If you are a DFSORT user you are missing PTF supporting PUSH parameter. Or id you are a SYncSort user which version of it?

Posted: Mon Jun 22, 2009 6:46 pm
by arcvns
nidhi1985 wrote:while doing a jjscan its giving me an error of severity 8
nidhi1985,

Some of the third party jcl-check products are so outdated that they dont recognize some the keywords used in sort control statements. Try submitting the job and post the error messages from SYSOUT here if you come across any issues.