|
View previous topic :: View next topic
|
| Author |
Message |
AJAYREDDY
New User
Joined: 17 Feb 2007 Posts: 52 Location: USA
|
|
|
|
I have Input file INFILE with record length 120 and Key is at position 64 with X(10).
This file is already sorted on Key field.
I need to write records in separate output files based on below scenarios. I need to compare the Key field and the field at position 10 (where it contains either ‘E’ or ‘F’). No other values are present at this location.
Examples:
AAAA05038 -- has 2 ‘E’ records with no matching ‘F’. These type of records should write in separate file OUTFILE1
BBBB05101, EEEE05145, GGGG05237 – has only one ‘E’ record with no matching ‘F’. These type of records should write in separate file OUTFILE2
CCCC05102 and FFFF05195 – has 2 ‘E’ and 1 ‘F’ record. These type of records should write in separate file OUTFILE3
DDDD05136 and IIII00062 - has matching 1 to 1 ‘E’ and ‘F’ record. These type of records should write in separate file OUTFILE4
HHHH00025 – has only one ‘F’ record with no matching ‘E’. These type of records should write in separate file OUTFILE5
The above are the only scenario’s in the INFILE. There are no other scenarios. Can anyone please let me know if this can be done through DFSORT?
Thanks
| Code: |
091008X69E AAAA05038
091016X69E AAAA05038
091007X69E BBBB05101
091025X69E CCCC05102
091029X69E CCCC05102
091030X69F CCCC05102
091021X69E DDDD05136
091022X69F DDDD05136
091015X69E EEEE05145
091025X69E FFFF05195
091029X69E FFFF05195
091030X69F FFFF05195
091008X69E GGGG05237
091027X69F HHHH00025
091020X69E IIII00062
091021X69F IIII00062 |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
So you can have 1, 2 or 3 records with each key, and the rules for which records go to which files are as follows?
OUTFIL1 - 2 records with key - 2 'E'
OUTFIL2 - 1 record with key - 1 'E'
OUTFIL3 - 3 records with key - 2 'E', 1 'F'
OUTFIL4 - 2 records with keys - 1 'E', 1 'F'
OUTFIL5 - 1 record with key - 1 'F'
And there are no other cases, like these?
2 records with key - 2 'F'
3 records with key - 1 'E', 2'F'
... |
|
| Back to top |
|
 |
AJAYREDDY
New User
Joined: 17 Feb 2007 Posts: 52 Location: USA
|
|
|
|
Frank,
Yes, there are no other cases like these.
2 records with key - 2 'F'
3 records with key - 1 'E', 2'F'
Only the 5 OUTFIL conditions that I sent are possible.
Thanks |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=your input fb 120 byte file,DISP=SHR
//T1 DD DSN=&&T1,DISP=(,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//OUT4 DD SYSOUT=*
//OUT5 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
SORT FROM(T1) USING(CTL2)
//*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(121:2C'0')),
IFTHEN=(WHEN=(10,1,CH,EQ,C'E'),OVERLAY=(121:C'1')),
IFTHEN=(WHEN=(10,1,CH,EQ,C'F'),OVERLAY=(122:C'1'))
OUTFIL FNAMES=T1,REMOVECC,BUILD=(1,120,3X),
SECTIONS=(64,9,
TRAILER3=(64:64,9,121:TOT=(121,1,ZD,EDIT=(T)),
TOT=(122,1,ZD,EDIT=(T)),C'T'))
//*
//CTL2CNTL DD *
SORT FIELDS=(64,9,CH,A,123,1,CH,D),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(123,1,CH,EQ,C'T'),PUSH=(121:121,2))
OUTFIL FNAMES=OUT1,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,20,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT2,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,10,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT3,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,21,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT4,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,11,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT5,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,01,AND,123,1,CH,EQ,C' ')
//* |
|
|
| Back to top |
|
 |
AJAYREDDY
New User
Joined: 17 Feb 2007 Posts: 52 Location: USA
|
|
|
|
Skolusu,
It is giving below error with return code 16 under DFSMSG step. Maybe it is problem with WHEN=GROUP identifier.
WER428I CALLER-PROVIDED IDENTIFIER IS "0001"
WER108I IN : RECFM=FB ; LRECL= 120; BLKSIZE= 27960
WER257I INREC RECORD LENGTH = 122
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER110I T1 : RECFM=FB ; LRECL= 123; BLKSIZE= 27921
WER405I T1 : DATA RECORDS OUT 6476; TOTAL RECORDS OUT 8993
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER054I RCD IN 6476, OUT 6476
| Code: |
CTL2CNTL :
SORT FIELDS=(64,9,CH,A,123,1,CH,D),EQUALS
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(123,1,CH,EQ,C'T'),PUSH=(121:121,2))
*
OUTFIL FNAMES=OUT1,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,20,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT2,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,10,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT3,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,21,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT4,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,11,AND,123,1,CH,EQ,C' ')
OUTFIL FNAMES=OUT5,BUILD=(1,120),
INCLUDE=(121,2,ZD,EQ,01,AND,123,1,CH,EQ,C' ')
WER428I CALLER-PROVIDED IDENTIFIER IS "0002"
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
|
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Your system uses Syncsort, not DFSORT.
Suggest you talk with management to get the product upgraded. |
|
| Back to top |
|
 |
dbzTHEdinosauer
Global Moderator

Joined: 20 Oct 2006 Posts: 6965 Location: porcelain throne
|
|
|
|
deleted by DBZ.
man, i am even slower than DS. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Me too. . .  |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
AJAYREDDY,
Kolusu's job works fine with DFSORT. The WER messages indicate you're using Syncsort, not DFSORT. Kolusu and I are DFSORT developers. DFSORT and Syncsort are competitive products. We're happy to answer questions on DFSORT and DFSORT's ICETOOL, but we don't answer questions on Syncsort. |
|
| Back to top |
|
 |
AJAYREDDY
New User
Joined: 17 Feb 2007 Posts: 52 Location: USA
|
|
|
|
| Thanks to all for the help. I will talk with management about DFSORT product. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
| Quote: |
| I will talk with management about DFSORT product. |
Why? Hopefully the management of that organization will not change products because some programmer wants to. . .
Suggest getting the Syncsort product up to current level. . . |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|