XXXX.file1.data
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
WRITTEN 00000008
DELETED 00000005
XXXX.file2.data
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
WRITTEN 00000058
DELETED 00000000
XXXX.file3.data
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
WRITTEN 00000658
DELETED 00000000
Output file :
LRECL 80 FB
File name Rec count
Code:
DATE : 2011-02-22 or any date format
XXXX.file1.data : WRITTEN - 00000008 DELETED 00000005 ( OR ZERO SUPPRESSED)
XXXX.file2.data : WRITTEN - 00000058 DELETED 00000000
XXXX.file3.data : WRITTEN - 00000658 DELETED 00000000
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Is
XXXX.file1.data
a record in the input file, or is it just the name of the dsname for that file?
DFSORT cannot obtain the dsname for a file automatically. You would have to specify it somehow. Given that, do you still want me to show you how to do this with DFSORT's GROUP function?
Hi Frank/Radhakrishnan,
Would you be able to show me how this can be achieved without using a ICETOOL step with only a GROUP for this scenario, please? I have a similar requirement where I would have to accomplish this in a single step but not using ICETOOL.
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
By now you should know you need to post some sample input and the output you want from the sample input (not necessarily complete records, but only the relevant fields). You also should mention the recfm and lrecl of the files. Post the "rules" for getting from the input to the output.
If someone is to spend time doing this for you, you need to at least provide info about what you want to accomplish. . .
Hi Dick/Frank,
I agree. But I thought I will try to extrapolate if someone showed me how it can be done for this particular scenario.
Anyway, I will provide my case here..
I have a file which has blocks of two records as in the example below. First record has to be compared with the second record. The comparision has to be between the delimiter values. The comparision result has to be the third record on the output. If it has a mismatch, we would have a 'Y', else it would be spaces as in the example below. Finally, the last record in the report will give us the count of 'Y' (mismatch values) columnwise. Here, when I say columnwise, it means each value between the delimiters. There are 25 such colums on my report, but I have mentioned only 3 in the sample below for the ease of explaining. Each column is about 10 bytes long. The LRECL=292 and RECFM=FB.
Input:
Code:
BEFORE IMG:- 000100000 ¦BALAJI ¦DATA
AFTER IMG:- 000100000 ¦ARNOLD ¦DATA
BEFORE IMG:- 000200000 ¦XXXXXX ¦DATA
AFTER IMG:- 000200000 ¦XXXXXX ¦DATA1
BEFORE IMG:- 000300000 ¦XXXXX1 ¦DATA2
AFTER IMG:- 000300000 ¦XXXXX1 ¦DATA2
Output:
Code:
BEFORE IMG:- 000100000 ¦BALAJI ¦DATA
AFTER IMG:- 000100000 ¦ARNOLD ¦DATA
MISMATCH IND:- ¦ Y
BEFORE IMG:- 000200000 ¦XXXXXX ¦DATA
AFTER IMG:- 000200000 ¦XXXXXX ¦DATA1
MISMATCH IND:- ¦ ¦ Y
BEFORE IMG:- 000300000 ¦XXXXX1 ¦DATA2
AFTER IMG:- 000300000 ¦XXXXX1 ¦DATA2
MISMATCH IND:- ¦ ¦
MISMATCH TOT:- 0 ¦ 1 ¦ 1
Quote:
Why?
My folks here are against me using a ICETOOL solution whenever I comeup with one. But they are okay with a SORT solution and so I thought I will use this post as a template and try to build mine without a ICETOOL. Moreover, I had posted my ICETOOL solution here but it was deleted which I thought was correct as the solution was requested in SORT and not ICETOOL.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
I suspect JOINKEYS and lots of IFTHEN statements would be required to do this.
Are the fields actually in fixed positions in each record? For example, field 1 is always in positions 18-27, field2 is always in positions 29-35, and so on? If so, please give the starting position and length of each field.
Or can each field actually be variable length and delimited? If so, give the maximum length of each field.
Where do you want the 'Y' in each column? First character? Last character? Or what? Where do you want the total in each column and how long should it be?
Please run this job and show the //SYSOUT messages you receive, so I can see what level you're at:
First of all, I will try to answer your questions.
Quote:
Are the fields actually in fixed positions in each record? For example, field 1 is always in positions 18-27, field2 is always in positions 29-35, and so on? If so, please give the starting position and length of each field.
The fields are all in fixed positions. I think the data got misaligned on this page when I submitted here. Each of the columns are 10 bytes long and their starting positions are 18, 29 and 40 respectively for the First, second and third columns.
Quote:
Where do you want the 'Y' in each column? First character? Last character? Or what?
The 'Y's have to be almost at the middle of each delimited field. This also has to be delimited.
Quote:
Where do you want the total in each column and how long should it be?
The totals has to be the trailing record, giving the totals column wise and the number should be almost in the middle of each delimited field.
Quote:
Please run this job and show the //SYSOUT messages you receive, so I can see what level you're at:
Code:
SYSIN :
OPTION COPY 0000980
WER276B SYSDIAG= 11205082, 16502744, 16502744, 5676075
WER164B 6,884K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 272K BYTES USED
WER146B 32K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER110I SORTOUT : RECFM=FB ; LRECL= 80; BLKSIZE= 80
WER410B 5,856K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 156K BYTES USED
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B BSAM WAS USED FOR SORTIN
WER416B BSAM WAS USED FOR SORTOUT
WER054I RCD IN 1, OUT 1
WER169I RELEASE 1.3 BATCH 0494 TPF LEVEL 2.0
WER052I END SYNCSORT - A491815B,S1,,DIAG=A000,6244,8806,00C4,E8FA,4CCB,8A08,86
This is how my control card looks like when I tried to build it for a LRECL=80, RECFM=FB.
Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
BEFORE IMG:- 000100000 ¦BALAJI ¦DATA
AFTER IMG:- 000100000 ¦ARNOLD ¦DATA
BEFORE IMG:- 000200000 ¦XXXXXX ¦DATA
AFTER IMG:- 000200000 ¦XXXXXX ¦DATA1
BEFORE IMG:- 000300000 ¦XXXXX1 ¦DATA2
AFTER IMG:- 000300000 ¦XXXXX1 ¦DATA2
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,13,CH,EQ,C'BEFORE IMG:-'),
RECORDS=2,PUSH=(200:SEQ=1)),
IFTHEN=(WHEN=(200,1,ZD,EQ,2),
BUILD=(81:1,80,200:200,1,260:C'¦',271:C'¦',350:C'0',
361:C'0',372:C'0'))
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(200,1,ZD,EQ,1),
RECORDS=2,PUSH=(1:1,80)),
IFTHEN=(WHEN=(18,10,CH,NE,98,10,CH),
OVERLAY=(250:C' Y ',350:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(29,10,CH,NE,109,10,CH),
OVERLAY=(261:C' Y ',361:C'1'),HIT=NEXT),
IFTHEN=(WHEN=(40,10,CH,NE,120,10,CH),
OVERLAY=(272:C' Y ',372:C'1'))
OUTFIL FNAMES=SORTOUT,INCLUDE=(200,1,ZD,EQ,2),REMOVECC,
TRAILER1=(1:C'MISMATCH TOT:-',
22:TOT=(350,1,ZD,M10,LENGTH=2),28:C'¦',
33:TOT=(361,1,ZD,M10,LENGTH=2),39:C'¦',
44:TOT=(372,1,ZD,M10,LENGTH=2),
80:X),
BUILD=(1,80,/,81,80,/,C'MISMATCH IND:-',3X,250,32)
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
Hello,
At the top of the informational output generated (above the messages) the release is shown. It will probably help someone help you if you post this line also.