|
View previous topic :: View next topic
|
| Author |
Message |
rajesh7523
New User
Joined: 15 Dec 2022 Posts: 8 Location: BHOPAL
|
|
|
|
I want to check the GRAND TOTALS .00 if it is GRAND TOTALS .00 than we have to add "No Data" in line 5 and we are also adding HEADER1& TRAILER1 in report And if GRAND TOTALS .00 not than it will simply add HEADER1& TRAILER1 in report
| Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(1:'BEGIN',/,
1:'KEY2',/,
1:'LOB ',/,
1:'BEGIN',/,
1:'KEY A3'),
TRAILER1=(1:'END',/,
1:'END') |
Input file:
| Code: |
000001 1 3/15/2023
000002 RECORDS CHANGED
000003
000004 0p NO. PRE PM
[b]000005 [/b]
000006 1 3/15/2023
000007 RECORDS CHANGED
000008
000009 0 NO. PRE PM
000010
000011 GRAND TOTALS .00 .00
000012 |
Let me know the sort logic, Help me if u KNOW[/code] |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| Why not add the line to the original report? Also, you have several .00 totals, which should be the correct one? |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1448 Location: Bamberg, Germany
|
|
|
|
| Code: |
//WHATEVER EXEC PGM=ICEMAN
//F1 DD *
1 3/15/2023
RECORDS CHANGED
0p NO. PRE PM
1 3/15/2023
RECORDS CHANGED
0 NO. PRE PM
GRAND TOTALS .00 .00
/*
//F2 DD .. <* same as above
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=F1,FIELDS=(81,1,A),SORTED,NOSEQCK
JOINKEYS F2=F2,FIELDS=(81,1,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,80,F2:82,1)
INREC IFTHEN=(WHEN=INIT,OVERLAY=(82:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(82,8,ZD,EQ,+5,AND,81,1,CH,EQ,C'X'),
OVERLAY=(C'No Data'))
OUTFIL FNAMES=(SORTOUT),
:
BUILD=(1,80)
END
/*
//JNF1CNTL DD *
INREC OVERLAY=(82:X)
END
/*
//JNF2CNTL DD *
INCLUDE COND=(1,80,SS,EQ,C'GRAND TOTALS')
INREC IFTHEN=(WHEN=(1,80,SS,EQ,C' .00 '),BUILD=(82:C'X'))
END
/* |
|
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| rajesh7523 wrote: |
I want to check the GRAND TOTALS .00 if it is GRAND TOTALS .00 than we have to add "No Data" in line 5 and we are also adding HEADER1& TRAILER1 in report And if GRAND TOTALS .00 not than it will simply add HEADER1& TRAILER1 in report
| Code: |
SORT FIELDS=COPY
OUTFIL REMOVECC,
HEADER1=(1:'BEGIN',/,
1:'KEY2',/,
1:'LOB ',/,
1:'BEGIN',/,
1:'KEY A3'),
TRAILER1=(1:'END',/,
1:'END') |
Input file:
| Code: |
000001 1 3/15/2023
000002 RECORDS CHANGED
000003
000004 0p NO. PRE PM
[b]000005 [/b]
000006 1 3/15/2023
000007 RECORDS CHANGED
000008
000009 0 NO. PRE PM
000010
000011 GRAND TOTALS .00 .00
000012 |
Let me know the sort logic, Help me if u KNOW[/code] |
I have re-read this screed about 10 times, but was not able to understand your goal.
Please, give the exact sample: how your output must look like??? |
|
| Back to top |
|
 |
rajesh7523
New User
Joined: 15 Dec 2022 Posts: 8 Location: BHOPAL
|
|
|
|
If we give this i/p file
| Code: |
000001 1 3/15/2023
000002 RECORDS CHANGED
000003
000004 0p NO. PRE PM
000005
000006 1 3/15/2023
000007 RECORDS CHANGED
000008
000009 0 NO. PRE PM
000010
000011 GRAND TOTALS .00
000012
|
than Expected o/p
| Code: |
000001 BEGIN
000002 KEY2
000003 LOB
000004 BEGIN
000005 KEY A3
000006 1 3/15/2023
000007 RECORDS CHANGED
000008
000009 0p NO. PRE PM
000010 No Data
000011 1 3/15/2023
000012 RECORDS CHANGED
000013
000014 0 NO. PRE PM
000015
000016 GRAND TOTALS .00
000017
000018 END
000019 END
|
And if we give i/p this
| Code: |
000001 1 3/15/2023
000002 RECORDS CHANGED
000003
000004 0p NO. PRE PM
000005 8754 88 63 91
000006 1 3/15/2023
000007 RECORDS CHANGED
000008
000009 0 NO. PRE PM
000010 88 63 91
000011 GRAND TOTALS 63.00
000012
|
Than Expected o/p
| Code: |
000001 BEGIN
000002 KEY2
000003 LOB
000004 BEGIN
000005 KEY A3
000006 1 3/15/2023
000007 RECORDS CHANGED
000008
000009 0p NO. PRE PM
000010 8754 88 63 91
000011 1 3/15/2023
000012 RECORDS CHANGED
000013
000014 0 NO. PRE PM
000015 88 63 91
000016 GRAND TOTALS 63.00
000017
000018 END
000019 END
|
Is it clear or still you have doubt |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
I'm leaving addition of headers/trailers as your own excersize.
| Code: |
//SORT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFMSG DD SYSOUT=*
//*
//SORTIN DD *
1 3/15/2023
RECORDS CHANGED
0P NO. PRE PM
1 3/15/2023
RECORDS CHANGED
0 NO. PRE PM
GRAND TOTALS .00
1 3/15/2023
RECORDS CHANGED
0P NO. PRE PM
8754 88 63 91
1 3/15/2023
RECORDS CHANGED
0 NO. PRE PM
88 63 91
GRAND TOTALS 63.00
//*
//GROUPS DD SPACE=(TRK,(10,10))
//TOTALS DD SPACE=(TRK,(10,10))
//*
//SORTOUT DD SYSOUT=*
//*
//TOOLIN DD *
COPY FROM(SORTIN) TO(GROUPS,TOTALS) USING(GRPS)
COPY JKFROM TO(SORTOUT) USING(JOIN)
//*
//GRPSCNTL DD *
INREC IFTHEN=(WHEN=GROUP,
END=(2,13,CH,EQ,C'GRAND TOTALS'),
PUSH=(81:ID=5)),
IFTHEN=(WHEN=(2,13,CH,EQ,C'GRAND TOTALS'),
OVERLAY=(86:15,15,UFF,EDIT=(TTTTTTTTTT)))
OUTFIL FNAMES=(GROUPS)
OUTFIL FNAMES=(TOTALS),
INCLUDE=(2,13,CH,EQ,C'GRAND TOTALS')
//*
//JOINCNTL DD *
JOINKEYS F1=GROUPS,
FIELDS=(81,5,A),SORTED
JOINKEYS F2=TOTALS,
FIELDS=(81,5,A),SORTED
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F1:1,80,F2:81,15,?)
OUTFIL IFTHEN=(WHEN=(96,1,CH,EQ,C'B',
AND,01,11,CH,EQ,C'0P NO.',
AND,86,10,ZD,EQ,+0),
BUILD=(1,80,/,C'No data')),
IFTHEN=(WHEN=NONE,BUILD=(1,80))
//* |
| Code: |
********************************* TOP OF DATA **********
1 3/15/2023
RECORDS CHANGED
0P NO. PRE PM
No data
1 3/15/2023
RECORDS CHANGED
0 NO. PRE PM
GRAND TOTALS .00
1 3/15/2023
RECORDS CHANGED
0P NO. PRE PM
8754 88 63 91
1 3/15/2023
RECORDS CHANGED
0 NO. PRE PM
88 63 91
GRAND TOTALS 63.00
******************************** BOTTOM OF DATA ********* |
|
|
| Back to top |
|
 |
rajesh7523
New User
Joined: 15 Dec 2022 Posts: 8 Location: BHOPAL
|
|
|
|
And if i want to skip all records or delete the entire record when INREC or OUTREC condition satisfies??
In above i/p file, condition is checking if GRAND TOTAL 00
then only we are skipping or deleting entire records
I i/p file format is VBA
let me know the logic |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2290 Location: USA
|
|
|
|
| rajesh7523 wrote: |
And if i want to skip all records or delete the entire record when INREC or OUTREC condition satisfies??
|
Then you need to add appropriate parameters to corresponding statements.
Do you suggest me to do it instead of you?
| rajesh7523 wrote: |
In above i/p file, condition is checking if GRAND TOTAL 00
then only we are skipping or deleting entire records
|
Wrong. GRAND TOTAL 00 is checked to find the group where to add your special comment.
| rajesh7523 wrote: |
I i/p file format is VBA
let me know the logic |
The logic (e.g. algorithm) does not depend on record format (which is also not FILE FORMAT!!!!)
You MUST try to understand the suggested logic for RECFM=FB yourself.
Next step would be - updating some parameters (not logic!) to handle RECFM=VB/VBA |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|