Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Syncsort matching

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Mon May 19, 2008 4:29 pm    Post subject: Syncsort matching
Reply with quote

I have two files of LRECL 100 each.
I want to match the two files record-wise.
My intention is to write a record to the output file (from the first i/p file) if there is any change in the 10th character of the two i/p files.

Basically I'm matching 1st record of i/p file-1 to 1st record of i/p file-2 and if a change happens in 10th character, record from i/p file-1 will be written to o/p.

I wrote an SYNCTOOL job to perform this.

Code:

COPY FROM(IN1) TO(T1) USING(CTL1)                       
COPY FROM(IN2) TO(T1) USING(CTL2)                       
SELECT FROM(T1) TO(OUT) ON(102,8,ZD) ON(10,1,CH)  NODUPS-
  USING(CTL3)


where IN1 and IN2 are i/p files.

CTL1 is
Code:
INREC OVERLAY=(101:C'1',102:SEQNUM,8,ZD)



CTL2 is
Code:
INREC OVERLAY=(101:C'2',102:SEQNUM,8,ZD)


CTL3 is
Code:
OUTFIL FNAMES=OUT,INCLUDE=(101,1,CH,EQ,C'2'),BUILD=(1,100)


Now I have an added requirement. According to the card given here, whatever be the change for 10th character, it will be written to the o/p file.

Now I want it as only if the 10th character changes from Y to N, I need to write the record to the o/p file.

Can something be added to this same sort card to get the desired o/p
Back to top
View user's profile Send private message

sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Mon May 19, 2008 5:46 pm    Post subject:
Reply with quote

raak,
The best way to do this one is using 'JOIN' function of SYNCSORT.Please check the SYNCSORT version of your shop and let us know.
Please also provide the sample input and the expected output.

Thanks

Krishy
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Mon May 19, 2008 6:17 pm    Post subject:
Reply with quote

Here's the SYNCSORT JOINKEYS method that would do the trick.

CTL1

INREC FIELDS=(1,100,101,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'Y')

CTL2

INREC FIELDS=(1,100,101,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'N')

CTL3

JOINKEYS FILES=F1,FIELDS=(101,8,A)
JOINKEYS FILES=F2,FIELDS=(101,8,A)
SORT FIELDS=COPY
OUTFIL FILES=01,OUTREC=(1,100)
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Mon May 19, 2008 6:19 pm    Post subject:
Reply with quote

sorry the CTL1 & CTL2 should be

CTL1

INREC FIELDS=(1,100,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'Y')

CTL2

INREC FIELDS=(1,100,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'N')
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Mon May 19, 2008 7:53 pm    Post subject: Reply to: Syncsort matching
Reply with quote

raak,

Search the JCL forum for "JOINKEYS" and you would find similar topics/examples.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed May 21, 2008 3:35 pm    Post subject:
Reply with quote

Quote:
Here's the SYNCSORT JOINKEYS method that would do the trick.

CTL1

INREC FIELDS=(1,100,101,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'Y')

CTL2

INREC FIELDS=(1,100,101,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'N')

CTL3

JOINKEYS FILES=F1,FIELDS=(101,8,A)
JOINKEYS FILES=F2,FIELDS=(101,8,A)
SORT FIELDS=COPY
OUTFIL FILES=01,OUTREC=(1,100)


there is one problem with this card.. It will take only those records which has a 'Y' in the 10th position from file-1 and 'N' in the 10th position from file-2.
here the problem is that my record sequence in both files might get corrupted..for eg:

File 1
123456789Y
012345678N
901234567Y

File 2
123456789N
012345678N
901234567N

in this case, only the first 2 records from the input file-1 will be included and 3 records from file-2 will be included - as per the INCLUDE condition in the cards.
So effectively the 3rd record from input file-1 will be matched against 2nd record from file-2.

Is this happening the same way I described or am I getting wrong somewhere???
Back to top
View user's profile Send private message
sril.krishy

Active User


Joined: 30 Jul 2005
Posts: 183
Location: hyderabad

PostPosted: Wed May 21, 2008 3:49 pm    Post subject:
Reply with quote

raak,
What is the output file you are expecting from the below 2 sample i/p files ?

File 1
123456789Y
012345678N
901234567Y

File 2
123456789N
012345678N
901234567N

Thanks
Krishy
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed May 21, 2008 4:36 pm    Post subject: Reply to: Syncsort matching
Reply with quote

did you try the JOINKEYs. What was the output you were getting. Please let us know.
Below is the description of what the Sort is doing.


File-1
123456789Y
012345678N
901234567Y

File-2
123456789N
012345678N
901234567N


Selection from File-1

123456789Y00000001
901234567Y00000003

Selection from File-2
123456789N00000001
012345678N00000002
901234567N00000003

The JOINKEYS are on SEQNUM,hence,

123456789Y00000001 of File-1 will match against 123456789N00000001 of File-2
901234567Y00000003 of File-1 will match against 901234567N00000003 of File-2

In the output you will get

123456789
901234567
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Wed May 21, 2008 4:44 pm    Post subject: Reply to: Syncsort matching
Reply with quote

Can we actually combine ICETOOL with JOINKEYS feature...I am getting some error messages as DDnames CTL3JNF1 and CTL3JNF2 are required...
Back to top
View user's profile Send private message
kalukakkad

New User


Joined: 10 Mar 2005
Posts: 81

PostPosted: Wed May 21, 2008 5:20 pm    Post subject: Reply to: Syncsort matching
Reply with quote

you have to use SYNCTOOL. Try with this JCL.

//SORT EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=XXXX.IN1,DISP=SHR
//IN2 DD DSN=XXXX.IN2,DISP=SHR
//CTL1JNF1 DD DSN=XXXXXX.Temp1,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,1))
//CTL1JNF2 DD DSN=XXXXXX.Temp2,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,1))
//CTL1OF01 DD DSN=XXXXXXX.OUTPUT,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(1,1))
//TOOLIN DD *
SORT FROM(IN1) TO(CTL1JNF1) USING(CTL0)
SORT FROM(IN2) TO(CTL1JNF2) USING(CTLA)
SORT FROM(CTL1JNF1) USING(CTL1)
//CTL0CNTL DD *
INREC FIELDS=(1,100,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'Y')
//CTLACNTL DD *
INREC FIELDS=(1,100,SEQNUM,8,ZD)
SORT FIELDS=COPY
INCLUDE FIELDS=(10,1,CH,EQ,C'N')
//CTL1CNTL DD *
JOINKEYS FILES=F1,FIELDS=(101,8,A)
JOINKEYS FILES=F2,FIELDS=(101,8,A)
REFORMAT FIELDS=(F1:1,100)
SORT FIELDS=COPY
OUTFIL FILES=01,OUTREC=(1,100)
/*


IN1 File has

123456789Y
012345678N
901234567Y

IN2 File has

123456789N
012345678N
901234567N
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts Matching and unmatching records scdinesh DFSORT/ICETOOL 11 Tue Feb 07, 2017 12:41 am
No new posts SYNCSORT SEQNUM and FI fields. nartcr SYNCSORT 7 Sat Jan 21, 2017 4:02 am
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us