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

Cycle no in each files


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

New User


Joined: 10 Jul 2007
Posts: 24
Location: Blore

PostPosted: Sun Mar 16, 2008 8:08 am
Reply with quote

hi,
I have 2 files,one has 1 rec and other has many records.
File 1
------
REGIONA123

File2
-----
12012008regiona123
11111
22222
33333
44444

My requirement is to compare the cycle no in each file and if match should return code 0 and not match rc 4 and change the file1 to match file2 using SYNCSORT only.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Sun Mar 16, 2008 11:46 am
Reply with quote

Hi,

This can be done but what is 'cycle no.', there is no reference of this in Your files shown, is it 'regiona123'?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sun Mar 16, 2008 11:56 am
Reply with quote

assuming that the Cycle no. is REGIONA123.
Is that the Cycle no. may be present in any position in your second file?
What is the RECFM and LRECL of your input and o/p files?
Back to top
View user's profile Send private message
Unique

New User


Joined: 10 Jul 2007
Posts: 24
Location: Blore

PostPosted: Sun Mar 16, 2008 2:44 pm
Reply with quote

Hi,
In the input file FILE 1 , there is only one record with the data as <Region><Cycle NO>.
REGIONA is the test region and cycle no is 123 and the length is 80 FB

the second file contains the
first record as <Date><Region><CYCLE NO>
and the rest of the records have data for that cycleno

i need to match the cycle no in both the files and if matching ,i should be get RC=0 and if notmatching, set RC=4 and change the cycle no in the file1 same as second file.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Sun Mar 16, 2008 4:46 pm
Reply with quote

Hi
Code:
//********************************************************************
//SORT1    EXEC PGM=SYNCSORT                                         
//SORTJNF1 DD DSN=HLQ.TEST.FB80,DISP=SHR                         
//SORTJNF2 DD *                                                       
12012008REGIONA123                                                   
11111                                                                 
22222                                                                 
33333                                                                 
44444                                                                 
//SORTOUT  DD DSN=&&TEMP,DISP=(,PASS),UNIT=SYSDA                     
//SORTOF01 DD DSN=&&TEMP1,DISP=(MOD,PASS),SPACE=(TRK,(5,5)),UNIT=SYSDA
//SYSOUT   DD SYSOUT=*                                               
//SYSIN    DD *                                                       
  JOINKEYS FILE=F1,FIELDS=(8,3,A)                                     
  JOINKEYS FILE=F2,FIELDS=(16,3,A)                                   
  REFORMAT FIELDS=(F2:9,10)                                           
  SORT FIELDS=COPY                                                   
  OUTFIL FILES=01,INCLUDE=(1,6,CH,EQ,C'REGION'),NULLOFL=RC4,         
         OVERLAY=(80:C' ')                     
//*                                           
//SORT2  EXEC PGM=SORT,COND=(04,EQ,SORT1)     
//SORTIN DD  DSN=&&TEMP1,DISP=(MOD,PASS,DELETE)
//SORTOUT DD DSN=HLQ.TEST.FB80,DISP=SHR   
//SYSOUT  DD SYSOUT=*                         
//SYSIN  DD *                                 
 OPTION COPY         


Explanaion:
in step SORT1 the DD SORTJNF1 contains your first file contents
Code:
REGIONA123


DD SORTJNF2 will contain the second file contents.

JOINKEYS will match the keys, the OUTFIL will set return code 00 if the key matched else returns 04.
The step SORT2 will excecute only if the step SORT1 returns 04. This step when excecuted will update the latest key from second file to first file.

Hope this is what you wanted!!! icon_cool.gif
Back to top
View user's profile Send private message
Unique

New User


Joined: 10 Jul 2007
Posts: 24
Location: Blore

PostPosted: Sun Mar 16, 2008 9:18 pm
Reply with quote

I will try your solution and will let you know.
Back to top
View user's profile Send private message
Unique

New User


Joined: 10 Jul 2007
Posts: 24
Location: Blore

PostPosted: Mon Mar 17, 2008 2:31 am
Reply with quote

Hi Krisprem,
I tried ur solution .I am able to get rc=0 if the cycle no matchs and rc=4,when cycle no mismatches. But when there is a mismatch,the input file1 is not updated with the cycle no of file2. Please guide

Thanks
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 496
Location: USA

PostPosted: Tue Mar 18, 2008 2:31 am
Reply with quote

Unique,

Try the modified second step I emailed you with COND=(04,NE,SORT1).
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top