Page 1 of 1

compare header data and record count with trailer data

PostPosted: Tue Aug 10, 2010 4:06 pm
by erameshkumarkgm
Hi ,

I have a file with the below data
xxxxxxxHMBD 20100515
record 1
record 2
.
.
record 2552
xxxxxxxTMBD 201005150002552

1.i have to compare header and trialer first 7 bytes 'xxxxxxx'
2.compare date of the header and trailer EG: here 20100515
3.compare total record count with the count in trailer
4.finally if all the conditions satisfy fire RC 4 if any one of the condition fails then fire rc 12

so i plan to write the header and trailer along with count as shown below .

xxxxxxx20100515
---------------------0002552xxxxxxx20100515
please assume - as spaces
After this i plan to use SLICE and then compare the data.
i have tried the below code but both are copying the input to output.
code 1:
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
/*
//CTL1CNTL DD *
OPTION COPY
INCLUDE=(1,8,CH,EQ,C'CMSMSPDH')
BUILD=(1,7,17,8,80:1X)
TRAILER1=(16:COUNT-1=(M11,LENGTH=07),24:1,7,31:17,15)
/*
code 2:
//TOOLIN DD *
COPY FROM(IN) TO(T1) USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'CMSMSPDH'),BUILD=(1:1,7,8:17,8,80:1X))
OUTFIL REMOVECC,
TRAILER1=(16:COUNT-1=(M11,LENGTH=07),24:1,7,31:17,15)
/*
Can any one help me?

My system is using SYNCTOOL RELEASE 1.6.2 - COPYRIGHT 2007 SYNCSORT INC.

Re: compare header data and record count with trailer data

PostPosted: Wed Aug 11, 2010 12:12 pm
by erameshkumarkgm
Hi ,
I have tried the below and it worked till the writing the data in a single line to compare, i need to complete it by setting RC=16 IF the comparision is false.
STEP10 EXEC PGM=ICEMAN
SORTIN DD DSN=inp,DISP=SHR
*
SORTOF1 DD DSN=SRTFIL01,
*
SORTOF2 DD DSN=SRTFIL02,
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(10994:SEQNUM,7,ZD)),
IFTHEN=(WHEN=(1,8,CH,EQ,C'xxxxxxxT'), --------------------->here T is trailer as in the input
OVERLAY=(10994:10994,7,ZD,SUB,+2,M11,LENGTH=7))
OUTFIL FILES=1,INCLUDE=(1,8,CH,EQ,C'xxxxxxxH'), ---------------------->here H is header as in the input
OUTREC=(1:1,7,8:17,8,80:1X)
OUTFIL FILES=2,INCLUDE=(1,8,CH,EQ,C'xxxxxxxT'),
OUTREC=(1:10994,7,8:1X,9:1,7,16:17,15,80:1X)
/*
I got 2 files
file1data:
xxxxxxx0100515

file2 data:
0003343 xxxxxxx201005150003343

****************************************************************
STEPU050 EXEC PGM=SYNCSORT
****************************************************************
SORTJNF1 DD DSN=SRTFIL01,DISP=SHR
*
SORTJNF2 DD DSN=SRTFIL02,DISP=SHR
*
SORTOUT DD DSN=SRTFIL03,

SYSOUT DD SYSOUT=*
SYSPRINT DD SYSOUT=*
SYSIN DD *
JOINKEYS FILE=F1,FIELDS=(1,15,A)
JOINKEYS FILE=F2,FIELDS=(9,15,A)
REFORMAT FIELDS=(F1:1,15,F2:1,65)
INCLUDE COND=(1,22,CH,EQ,24,22,CH)
SORT FIELDS=COPY
/*
This copies the total data in file SRTFIL03.
I can't set RC=16 if it is nullout .
I have tried
OPTION NULLOUT=RC16, OUTFIL AND NULLOFL , PARM=PARM='NULLOUT=RC08'
can any one solve this.

Re: compare header data and record count with trailer data

PostPosted: Thu Aug 12, 2010 4:58 am
by Thampy
Hi,

The following SYNCSORT V1.3 jcl will produce the return code 0 if all the conditions mentioned by you satisfied,otherwise it will throw return code 16.

//STEP010 EXEC PGM=SORT,PARM='NORC16'
//SORTIN DD *
XXXXXXXHMBD 20100515
RECORD 1
RECORD 2
RECORD 3
RECORD 4
RECORD 5
RECORD 6
RECORD 7
RECORD 8
RECORD 9
RECORD 10
RECORD 11
RECORD 12
XXXXXXXTMBD 201005150000012
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,NULLOUT=RC16
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,7,ZD)),
IFTHEN=(WHEN=GROUP,BEGIN=(8,4,CH,EQ,C'HMBD'),
PUSH=(90:1,7,97:13,8)),
IFTHEN=(WHEN=(8,4,CH,EQ,C'TMBD'),
OVERLAY=(81:81,7,ZD,SUB,+2,TO=ZDF,LENGTH=7))
OUTFIL INCLUDE=(8,4,CH,EQ,C'TMBD',AND,1,7,CH,EQ,90,7,CH,AND,
81,7,ZD,EQ,21,7,ZD,AND,13,8,CH,EQ,97,8,CH)
/*

Re: compare header data and record count with trailer data

PostPosted: Sat Sep 25, 2010 11:55 pm
by sdstyer
Thampy,
Are you sure that is Syncsort 1.3? I am looking in the manual and I do not see the WHEN=GROUP option or the PUSH. If they are doing what I think they are doing I am going to ask my company's system programmer to get that version installed! There are a very few tasks which I have never been able to do in Syncsort and use Fileaid to do.

Re: compare header data and record count with trailer data

PostPosted: Sun Sep 26, 2010 3:23 am
by dick scherrer
Hello,

WHEN/GROUP is available is Syncsort. . .

I posted this more than a year ago:
Your release of Syncsort (1.3.0) is not at the level that supports when=group. This was included in 1.3.2 if i remember correctly.


Alissa posted this multiple times:
Support for WHEN=GROUP was included in SyncSort for z/OS 1.3.2 (SYNCTOOL Release 1.6.2).

Re: compare header data and record count with trailer data

PostPosted: Sun Sep 26, 2010 7:36 pm
by sdstyer
I will have to check on my companies specific version and try some of the Group examples then.

Syncsort for z/OS 1.3 Programmers Guide from 2008 does not mention it at all. I wonder how much difference the .2 in 1.3.2 makes. There probably is a more updated documentation out there somewhere.

Thanks for the update.

Re: compare header data and record count with trailer data

PostPosted: Sun Sep 26, 2010 10:39 pm
by dick scherrer
Hello,

Syncsort for z/OS 1.3 Programmers Guide from 2008 does not mention it at all.
Uhh - seldom does documentation contain info about features that do not exist. . .

I wonder how much difference the .2 in 1.3.2 makes.
At least enough to provide when/group. . . :)

There probably is a more updated documentation out there somewhere.
Documentation is free from Syncsort for organizations that are licensed to use the product.

Suggest you contact Alissa directly and she can help you determine where you "are" and what is nneded to become current as well as the documentation.

Re: compare header data and record count with trailer data

PostPosted: Tue Sep 28, 2010 1:57 am
by sdstyer
Thanks, I talked to the SysProg responsible for the application and the 1.3.2 version was on our web-site. It appears that I had copied it to my desktop when it was still 1.3.0 version.

I have the document now and have been playing with the WHEN=GROUP all day. Got everything figured out, just working out the details for what I am currently programming.

Re: compare header data and record count with trailer data

PostPosted: Tue Sep 28, 2010 4:54 am
by dick scherrer
Good to hear all is well - thank you for letting us know :)

d