View previous topic :: View next topic
Author
Message
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Hi,
I am using below job to write data to o/p file but the customer wants the count of each variety excluded using OMIT condition to appear in SYSOUT ! The file RECFM is FB and LRECL is 400.
Code:
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(1,3,CH,EQ,C'HDR',OR,1,3,CH,EQ,C'ETR',OR,
1,20,CH,EQ,C' ',OR,
1,20,CH,EQ,C'99999999999999999999')
OUTFIL FILES=(OUT,1),
IFTHEN=(WHEN=(1,34,CH,EQ,C'TLR'),BUILD=(40,361,29X)),
IFTHEN=(WHEN=NONE,BUILD=(1,400))
Here a total of 4 types of input records are excluded:
Quote:
HDR
ETR
If record has 20 spaces starting at 1st column
If record has 20 9s starting at 1st column
So, I would like to have these 4 counts to be appeared in SYSOUT. Also, please let me know if the 20 spaces and 9s can be represented in any other format instead of typing it that long !
Thanks.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Ramsri,
What is the purpose of this? Why routing the same data to 2 different ddnames?
Code:
OUTFIL FILES=(OUT,1),
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Ramsri,
Please post some sample input records and the expected output out of it. Do you need the output records in the same order as input or the order doesn't matter?
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
arcvns,
We create two files because one file will be reformatted and another one will be used in other job steps. We strip first 27 bytes, exclude other types and write remaining records. So, I need the output records in same order as in input file.
Sample Recrods:
Code:
ETR9999999999999999999999999999999999999999999999999999999999999999999999999999
99999999999999999999999999999999999999999999999999999999999999999999999999999999
HDRIFZ 081128214543 00907
TLR311224VOM 11281703SUPERMGMT E 00000121454 TIM200711281703OMGUIORIENA000062
00000121454 NA132008 000001131860000200000118445000011AT46 0001
00000121454 NB13+14B +1LS +50U +B36 +F1A +FE9 +MX0 +PCW +R8N +R8P +RFA +VK3
00000121454 NA482008 00000119390000020000011375800001TK10906 0001
Output:
Code:
00000121454 TIM200711281703OMGUIORIENA000062
00000121454 NA132008 000001131860000200000118445000011AT46 0001
00000121454 NB13+14B +1LS +50U +B36 +F1A +FE9 +MX0 +PCW +R8N +R8P +RFA +VK3
00000121454 NA482008 00000119390000020000011375800001TK10906 0001
Thanks.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Ramsri,
Quote:
We strip first 27 bytes
You mentioned about stripping 27 bytes, but in the initial card you have taken off first 39 bytes for "TLR" records. Again from the posted sample data, the first 38 bytes seems to be ignored for these records. Please explain.
Input
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
TLR311224VOM 11281703SUPERMGMT E 00000121454 TIM200711281703OMGUIORIENA000062
Output
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
00000121454 TIM200711281703OMGUIORIENA000062
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Arun, sorry for the confusion. Yes. It is 39 bytes we want to strip off on TLR recrods.
Code:
//SYSIN DD *
SORT FIELDS=COPY
OMIT COND=(1,3,CH,EQ,C'HDR',OR,1,3,CH,EQ,C'ETR',OR,
1,20,CH,EQ,C' ',OR,
1,20,CH,EQ,C'99999999999999999999')
OUTFIL FILES=(OUT,1),
IFTHEN=(WHEN=(1,3,CH,EQ,C'TLR'),BUILD=(40,361,39X)),
IFTHEN=(WHEN=NONE,BUILD=(1,400))
Thanks.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Ramsri,
From whatever info has been posted so far, the below Syncsort job should do the trick for you. Try this and post back if you face any issues.
REJCNT in SYSOUT will have the required counts.
Code:
//STEP1 EXEC PGM=SORT
//SORTIN DD DSN=XXXXXXX.FB400.IN
//SYSOUT DD SYSOUT=*
//OUT DD DSN=XXXXXXX.FB400.OUT
//REJCNT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(404:SEQNUM,8,ZD,C'00000000')),
IFTHEN=(WHEN=(1,3,SS,EQ,C'HDR,ETR'),
OVERLAY=(401:1,3,6X,C': 00000001')),
IFTHEN=(WHEN=(1,20,CH,EQ,C' '),
OVERLAY=(401:C'20 SPACES',C': 00000001')),
IFTHEN=(WHEN=(1,20,CH,EQ,C'99999999999999999999'),
OVERLAY=(401:C'20 9s ',C': 00000001'))
SORT FIELDS=(401,11,CH,A)
SUM FIELDS=(412,8,ZD)
OUTFIL FNAMES=OUT,OMIT=(410,1,CH,EQ,C':'),BUILD=(40,361,400:X)
OUTFIL FNAMES=REJCNT,SAVE,BUILD=(401,19)
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Thank you. I am getting the counts as expected but the records are getting truncated!
Input Data:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
TLR311057AOM 12011501SUPERMGMT B 00000164118 AOM200812011501OMGUIORIER
00000161118 NA112909 000001845750000400000187434000014HP69 000156
00000161118 NB09+FVX +LGD +MX0 +1CX +FE9 +25U +83B +R6T +VQ2
00000161118 NA132909 000001131690000300000113397000011ZG69 000156
00000161118 NB11+LE5 +MN5 +1FL +FE9 +92U +34B +AG1 +B86 +FVX +R6T +VQ2
00000161118 NA222909 00000121777000060000012195800001ZR14526 000156
00000161118 NB14+LLT +MY9 +1XE +QLW +FE9 +51U +19C +ABB +PDC +QD6 +R6T +VI8
Wrong Output:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
00000161118 AOM200812011501OMGUIORIERA000006
1845750000400000187434000014HP69 000156315FLS
+FE9 +25U +83B +R6T +VQ2
1131690000300000113397000011ZG69 000156330FLS
+92U +34B +AG1 +B86 +FVX +R6T +VQ2
121777000060000012195800001ZR14526 000156325FLS
+FE9 +51U +19C +ABB +PDC +QD6 +R6T +VI8 +VQ2 +GW5
Expected Output:
Code:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
00000161118 AOM200812011501OMGUIORIERA000006
00000161118 NA112909 000001845750000400000187434000014HP69 000156
00000161118 NB09+FVX +LGD +MX0 +1CX +FE9 +25U +83B +R6T +VQ2
00000161118 NA132909 000001131690000300000113397000011ZG69 000156
00000161118 NB11+LE5 +MN5 +1FL +FE9 +92U +34B +AG1 +B86 +FVX +R6T +VQ2
00000161118 NA222909 00000121777000060000012195800001ZR14526 000156
00000161118 NB14+LLT +MY9 +1XE +QLW +FE9 +51U +19C +ABB +PDC +QD6 +R6T +VI8
Thanks again.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Quote:
Thank you. I am getting the counts as expected but the records are getting truncated!
Ramsri,
Yes, I forgot to add the condition in your initial sort card for "non-TLR" data records. Here's the modified version.
Code:
INREC IFTHEN=(WHEN=INIT,OVERLAY=(404:SEQNUM,8,ZD,C'00000000')),
IFTHEN=(WHEN=(1,3,SS,EQ,C'HDR,ETR'),
OVERLAY=(401:1,3,6X,C': 00000001')),
IFTHEN=(WHEN=(1,20,CH,EQ,C' '),
OVERLAY=(401:C'20 SPACES',C': 00000001')),
IFTHEN=(WHEN=(1,20,CH,EQ,C'99999999999999999999'),
OVERLAY=(401:C'20 9S ',C': 00000001'))
SORT FIELDS=(401,11,CH,A)
SUM FIELDS=(412,8,ZD)
OUTFIL FNAMES=OUT,OMIT=(410,1,CH,EQ,C':'),
IFTHEN=(WHEN=(1,3,CH,EQ,C'TLR'),BUILD=(40,361,400:X)),
IFTHEN=(WHEN=NONE,BUILD=(1,400))
OUTFIL FNAMES=REJCNT,SAVE,BUILD=(401,19)
Back to top
ramsri Active User Joined: 18 Oct 2008Posts: 380 Location: India
Arun, Excellent. I got it as expected.
Thank you very much......
Bye.
Back to top
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
Ramsri,
You're welcome.
Back to top
Please enable JavaScript!