View previous topic :: View next topic
Author
Message
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
surya4ug,
I have slightly modified Kolusu's code to make it work for you.
Code:
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,50,100C'0',61,10,SFF,ZD,LENGTH=10,
161:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(1,9,CH,EQ,C'ATTRIBUTE'),
OVERLAY=(163:SEQNUM,2,ZD),HIT=NEXT),
IFTHEN=(WHEN=(1,9,CH,NE,C'ATTRIBUTE'),
OVERLAY=(165:SEQNUM,2,ZD,163:161,2,ZD,SUB,165,2,ZD,M11,
LENGTH=2),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,01),OVERLAY=(051:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,02),OVERLAY=(061:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,03),OVERLAY=(071:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,04),OVERLAY=(081:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,05),OVERLAY=(091:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,06),OVERLAY=(101:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,07),OVERLAY=(111:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,08),OVERLAY=(121:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,09),OVERLAY=(131:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,10),OVERLAY=(141:151,10),HIT=NEXT)
SORT FIELDS=(1,50,CH,A),EQUALS
SUM FIELDS=(051,10,061,10,071,10,081,10,091,10,
101,10,111,10,121,10,131,10,141,10),FORMAT=ZD
OUTFIL OMIT=(1,9,CH,EQ,C'ATTRIBUTE'),REMOVECC,
BUILD=(1,50,
070:051,10,ZD,M10,LENGTH=10,082:061,10,ZD,M10,LENGTH=10,
093:071,10,ZD,M10,LENGTH=10,104:081,10,ZD,M10,LENGTH=10,
115:091,10,ZD,M10,LENGTH=10,126:101,10,ZD,M10,LENGTH=10,
137:111,10,ZD,M10,LENGTH=10,148:121,10,ZD,M10,LENGTH=10,
159:131,10,ZD,M10,LENGTH=10,170:141,10,ZD,M10,LENGTH=10,
181:051,10,ZD,ADD,061,10,ZD,ADD,071,10,ZD,ADD,
081,10,ZD,ADD,091,10,ZD,ADD,101,10,ZD,ADD,
111,10,ZD,ADD,121,10,ZD,ADD,131,10,ZD,ADD,
141,10,ZD,M10,LENGTH=12),
HEADER1=(070:'MISMATCHES FROM 10 FILES',/,
001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',
093:'FILE03 VAL',104:'FILE04 VAL',115:'FILE05 VAL',
126:'FILE06 VAL',137:'FILE07 VAL',148:'FILE08 VAL',
159:'FILE09 VAL',170:'FILE10 VAL',181:7X,'TOTAL')
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Perfect! Its working again. Thanks much!!
here are my final 2 requirements ( the % division part was also successful )
1) The constant is obtained as an output of one of the upstream jobs to the current job. Is there a way to provide it as a dynamic input and have the TOTAL divided by it and eventually multiply by 100
2) I want to append the current day to the header
Ex : MISMATCHES FROM 10 FILES2009-05-23
Is there a function in SYNCSORT that can accomplish this.
Thanks in advance.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
You're welcome.
1) Yes. Is it residing in a file? If yes, how do we extract it from it?
2) Yes.
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Yes it is residing in a file.
a) Is there a function that Can append the value thats present in the CONSTANT file to the TOTAL file, right at the end in the last column
b) then have the TOTAL field divided by the appended field and then multiply by 100
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
surya4ug,
From whatever you have posted so far,
You have a "constant" file from which you extract a numeric value. Is it having only a single record? If there are multiple records, is there any way to identify/extract the numeric constant? Post here some sample data from your constant file using "Code" tags. Also the RECFM/LRECL etc.
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Hmm..the constant file will look like :
Code:
Total no of input records : 1234567890
Total no of adds : 82509
Total no of changes : 6582954
Total no of deletes : 6486130
We need to pick the value 6582954 from
Code:
Total no of changes : 6582954
and append it to our original TOTAL file and proceed with dividing the TOTAL field with the constant and eventually multiply by 100.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Can this particular record be identified by "Total no of changes" at Pos 1-19?
What about the Starting position, Length and Format of the numeric field?
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Lets consider this case:
Total no. of change records (1-27 )
Constant : (35-45) -> numeric
Code:
Total no. of change records : 6758920522
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Hello,
See the latest job as per your "final version" of the requirement. This is untested. Try it out and post back if you come across any issues.
Code:
//STEP1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN= Constant file
//SORTOUT DD DSN=&&S1,DISP=(,PASS)
//SYSIN DD *
INCLUDE COND=(1,27,CH,EQ,C'Total no. of change records')
INREC BUILD=(C'CONST,+',35,11,UFF,ZD,LENGTH=11,80:X)
SORT FIELDS=COPY
//STEP2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=Your input file 01,DISP=SHR
// DD DSN=Your input file 02,DISP=SHR
// DD DSN=Your input file 03,DISP=SHR
// DD DSN=Your input file 04,DISP=SHR
// DD DSN=Your input file 05,DISP=SHR
// DD DSN=Your input file 06,DISP=SHR
// DD DSN=Your input file 07,DISP=SHR
// DD DSN=Your input file 08,DISP=SHR
// DD DSN=Your input file 09,DISP=SHR
// DD DSN=Your input file 10,DISP=SHR
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,50,100C'0',61,10,SFF,ZD,LENGTH=10,
161:SEQNUM,2,ZD)),
IFTHEN=(WHEN=(1,9,CH,EQ,C'ATTRIBUTE'),
OVERLAY=(163:SEQNUM,2,ZD),HIT=NEXT),
IFTHEN=(WHEN=(1,9,CH,NE,C'ATTRIBUTE'),
OVERLAY=(165:SEQNUM,2,ZD,163:161,2,ZD,SUB,165,2,ZD,M11,
LENGTH=2),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,01),OVERLAY=(051:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,02),OVERLAY=(061:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,03),OVERLAY=(071:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,04),OVERLAY=(081:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,05),OVERLAY=(091:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,06),OVERLAY=(101:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,07),OVERLAY=(111:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,08),OVERLAY=(121:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,09),OVERLAY=(131:151,10),HIT=NEXT),
IFTHEN=(WHEN=(163,2,ZD,EQ,10),OVERLAY=(141:151,10),HIT=NEXT)
SORT FIELDS=(1,50,CH,A),EQUALS
SUM FIELDS=(051,10,061,10,071,10,081,10,091,10,
101,10,111,10,121,10,131,10,141,10),FORMAT=ZD
OUTFIL OMIT=(1,9,CH,EQ,C'ATTRIBUTE'),REMOVECC,
BUILD=(1,50,
070:051,10,ZD,M10,LENGTH=10,082:061,10,ZD,M10,LENGTH=10,
093:071,10,ZD,M10,LENGTH=10,104:081,10,ZD,M10,LENGTH=10,
115:091,10,ZD,M10,LENGTH=10,126:101,10,ZD,M10,LENGTH=10,
137:111,10,ZD,M10,LENGTH=10,148:121,10,ZD,M10,LENGTH=10,
159:131,10,ZD,M10,LENGTH=10,170:141,10,ZD,M10,LENGTH=10,
181:051,10,ZD,ADD,061,10,ZD,ADD,071,10,ZD,ADD,
081,10,ZD,ADD,091,10,ZD,ADD,101,10,ZD,ADD,
111,10,ZD,ADD,121,10,ZD,ADD,131,10,ZD,ADD,
141,10,ZD,M10,LENGTH=12,
194:(051,10,ZD,ADD,061,10,ZD,ADD,071,10,ZD,ADD,
081,10,ZD,ADD,091,10,ZD,ADD,101,10,ZD,ADD,
111,10,ZD,ADD,121,10,ZD,ADD,131,10,ZD,ADD,
141,10,ZD),MUL,+100,DIV,CONST,M10,LENGTH=12, C' %'),
HEADER1=(070:'MISMATCHES FROM 10 FILES',/,
001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',
093:'FILE03 VAL',104:'FILE04 VAL',115:'FILE05 VAL',
126:'FILE06 VAL',137:'FILE07 VAL',148:'FILE08 VAL',
159:'FILE09 VAL',170:'FILE10 VAL',181:7X,'TOTAL',
194:7X,'PERCENT')
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Thanks Arun. Before i try this, could you please add the piece of code to append the current date (YY-MM-DD) to the header. that i requested previously
It should be right beside "'MISMATCHES FROM 10 FILES''.
Ex :
Code:
MISMATCHES FROM 10 FILES2009-05-24
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Try replacing the below part
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',/,
by
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',DATE1(-),/,
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Arun,
It throws an error : CONTINUATION STATEMENT ERROR FOUND
Code:
HEADER1=(070:'**********PERSONAL PROFILE FIELD-LEVEL STATS',DATE1(-))
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
Hi Arun,
I used &DATE and it worked....
Code:
Input:
---------
HEADER1=(001:'**********PERSONAL PROFILE FIELD-LEVEL STATS',&DATE)
Output
---------
Code:
**********PERSONAL PROFILE FIELD-LEVEL STATS05/24/09
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
You might try this
if you need to change the default separator.
Back to top
surya4ug New User Joined: 08 Jul 2008Posts: 62 Location: chennai
hmm... even &DATE(-) is throwing an error.
Code:
HEADER1=(001:'**********PERSONAL PROFILE FIELD-LEVEL STATS',&DATE(-))
Code:
WER274A CONTINUATION STATEMENT ERROR FOUND
Back to top
dick scherrer Moderator Emeritus Joined: 23 Nov 2006Posts: 19243 Location: Inside the Matrix
Hello,
If "I used &DATE and it worked .", is there still something that needs to be done?
I seem to have confused myself. . .
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Quote:
hmm... even &DATE(-) is throwing an error
See the correct syntax for dates below.
YY-MM-DD
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',&DATE=(YMD-),/,
001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',
................
................)
YYYY-MM-DD
Code:
HEADER1=(070:'MISMATCHES FROM 10 FILES',&DATE=(4MD-),/,
001:'ATTRIBUTE ',070:'FILE01 VAL',082:'FILE02 VAL',
................
................)
Back to top
Please enable JavaScript!