View previous topic :: View next topic
|
Author |
Message |
ankit9jain
New User
Joined: 20 Jan 2009 Posts: 17 Location: India
|
|
|
|
hi,
I have a requirement like below..
input file is having single record like
(constant,xxxxxx)
where value 'xxxxxx' value changes after every run
from the other input file, i need to match the records from particular column say col 23-28 ,which has same value as 'xxxxxx' from the first input and include the records in the output file.
since the job will be automated, i can not go and change the SORT card every time. is there any possiblity to match and include the records? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
You do not have to change anything in the jcl or sort parms,
search the forums for the "two files match"
in Your case the two file to match are ...
1) the big file
2) the file with the single record
3) output ( the file with the records from file 1 that match the single key ) |
|
Back to top |
|
|
ankit9jain
New User
Joined: 20 Jan 2009 Posts: 17 Location: India
|
|
|
|
hi, i searched the forum but could not get the required result.
could you please help on this? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
did You search with "two files match sort" ??
there are many many results for it
remember to check the "search for all terms" button |
|
Back to top |
|
|
ankit9jain
New User
Joined: 20 Jan 2009 Posts: 17 Location: India
|
|
|
|
sorry, but i again searched the forum but still did not get any idea...
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
here is an example
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD * INPUT FILE1
CONSTANT,XXXXXX
/*
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
INREC BUILD=(C'PICKME,''',10,6,C'''',80:X)
/*
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD * INPUT FILE2
A XXXXXX
B YYYYYY
C XXXXXX
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INCLUDE COND=(23,6,CH,EQ,PICKME)
/* |
Gerry |
|
Back to top |
|
|
ankit9jain
New User
Joined: 20 Jan 2009 Posts: 17 Location: India
|
|
|
|
thanks a lot ...
but how the "PICKME" isl matching the record?
it would be nice if you explain it a bit.. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
Step S1 creates a symbols dataset which looks like this
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
Oops,I submitted before completing my reply.
Step2 uses SYMNAMES DD which contains the symbol PICKME with a value of XXXXXX, PICKME in the include statement is resolved to XXXXXX.
Please note that my JCL contains 2 SORTOUT DD's. Please remove 1 of them. Duplicate has been removed from example jcl.
Test the example I have provided and you will see in the output the symbol substitution.
Gerry |
|
Back to top |
|
|
ankit9jain
New User
Joined: 20 Jan 2009 Posts: 17 Location: India
|
|
|
|
gr8, it is working fine.. thanks a lot |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
ankit9jain,
I guess this can be done in a single SYNCSORT JOIN step If you have SyncSort for z/OS 1.2 or higher. |
|
Back to top |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Assuming that the single record contains the changing value starting in position 11 for the length of 6, and the master file is FB/80, here is a SyncSort for z/OS JOIN application that will produce the desired output:
Code: |
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTOUT DD DSN=output.file,...
//SORTJNF1 DD DISP=SHR,DSN=MASTER.FILE
//SORTJNF2 DD DISP=SHR,DSN=SINGLE.RECORD
//SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(23,6,A)
JOINKEYS FILE=F2,FIELDS=(11,6,A)
REFORMAT FIELDS=(F1:1,80)
SORT FIELDS=COPY
/* |
Regards, |
|
Back to top |
|
|
|