IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to match the file using the constants


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ankit9jain

New User


Joined: 20 Jan 2009
Posts: 17
Location: India

PostPosted: Wed Jan 28, 2009 1:55 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 28, 2009 2:03 pm
Reply with quote

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
View user's profile Send private message
ankit9jain

New User


Joined: 20 Jan 2009
Posts: 17
Location: India

PostPosted: Wed Jan 28, 2009 3:21 pm
Reply with quote

hi, i searched the forum but could not get the required result.
could you please help on this?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jan 28, 2009 3:26 pm
Reply with quote

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
View user's profile Send private message
ankit9jain

New User


Joined: 20 Jan 2009
Posts: 17
Location: India

PostPosted: Wed Jan 28, 2009 4:00 pm
Reply with quote

sorry, but i again searched the forum but still did not get any idea...
icon_sad.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jan 28, 2009 4:01 pm
Reply with quote

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
View user's profile Send private message
ankit9jain

New User


Joined: 20 Jan 2009
Posts: 17
Location: India

PostPosted: Wed Jan 28, 2009 4:04 pm
Reply with quote

thanks a lot ...
but how the "PICKME" isl matching the record?
it would be nice if you explain it a bit..
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jan 28, 2009 4:13 pm
Reply with quote

Hi,

Step S1 creates a symbols dataset which looks like this

Code:
PICKME,'XXXXXX'
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Jan 28, 2009 4:21 pm
Reply with quote

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
View user's profile Send private message
ankit9jain

New User


Joined: 20 Jan 2009
Posts: 17
Location: India

PostPosted: Wed Jan 28, 2009 10:51 pm
Reply with quote

gr8, it is working fine.. thanks a lot
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Jan 28, 2009 11:19 pm
Reply with quote

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
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Thu Jan 29, 2009 7:32 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top