This may look redundant but could find the relevant post .
Input file - PS, FB, LRECL=100
Input file:
0DATETIMESTAMP
1ABDCDE.....
1EFGHIJK.....
1LMNOPQ.....
1RSTUVX.....
1YZABCD....
26 DATE
Header Record:
1 - '0' record type
2-9 - DATE
10-19 - TIMESTAMP
Detail Record:
1 - '1' record type
2-100 - Data
Trailer Record:
1 - '2' record type
2-10 - Count (right justified - no leading zeros)
11-18 - DATE
Need to:
1) Have RC=16 if no header OR trailer record
2) Have RC=16 if if the count in the trailer is incorrect (i.e it is not equal to total no. of records in the input file excluding the trailer record).
OK..Though I intended to achieve above requirement in single step..since no response..I am planning to do it in multiple steps:
i) Segregate input file into 3 files:
a) Header file - only having header - Later check if its empty then abend the job
b) Trailer file - only having trailer - Later check if its empty then abend the job
c) Detail file - for the actual data to be processed later.
Thus, requirement (1) can be achieved.
ii) For the requirement (2), I am taking a count of the input file(excluding trailer) in a new file. Then I am using JOINKEYS to compare the count in this file and the count in the Trailer file. If it is not equal, abend the job.
For this I am using the following sort-card:
Here the problem is - the count in the trailer file is right justified (no leading zeros as mentioned earlier) while the count in my count file (SORTJNF1) is with leading zeros. So the job is abending.
SORTJNF1:
Code:
=COLS> ----+----1----+----2----+----3----+----4----+--
****** ***************************** Top of Data *****
000001 2000000009
****** **************************** Bottom of Data ***
SORTJNF2:
Code:
=COLS> ----+----1----+----2----+----3----+----4----
****** ***************************** Top of Data **
000001 29 02172010
****** **************************** Bottom of Data
=COLS> ----+----1----+----2----+----3----+----4
****** ***************************** Top of Dat
000010 0021720101326
000100 19458746987456JKDJSJD7845T
000200 173464587486HJDSFHJKFDGKHFDKK
000300 183647845JKDGHJDFGHJDFGHJDFGHJ
000400 183545433IEIEIJJHJHJDFGHJDFGHJ
000500 1KJSDGSDKFKJ95794679KJDGJKDSFGJK
000600 25 02172010
Error:
Code:
WER405I HEADER : DATA RECORDS OUT 1; TOTAL RECORDS OUT 1
WER405I DETAIL : DATA RECORDS OUT 5; TOTAL RECORDS OUT 5
WER405I TRAILER : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER461A SORTOUT/OUTFIL DATA SET CONTAINS NO DATA RECORDS
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
As I find, the include for TRAILER is working fine but the count is not matching.Consequently, the Trailer file is empty and the job is abending.
Arun, I dint get the purpose of "SUB,+2" in the sort card. I am not aquainted with this. Can you pls explain this?
NOTE: As mentioned earlier, count in the trailer in Input file is right justified (no leading zeros). Mask M10 will have leading blanks (bbbbbbbT). We dont have any mask (M0 to M25) which can have trailing blanks.
above piece of sort card will count the records in the input (6 in this case) and then subtract 2 from it( to exclude header n trailer). So count will be 4 here.
But the correct count should be total no. of records(excluding trailer record). So we can resolve this by subtracting only 1.
2) Count in trailer is right justified while our count is left justified. So they will mismatch.
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Vivek,
Quote:
above piece of sort card will count the records in the input (6 in this case) and then subtract 2 from it( to exclude header n trailer). So count will be 4 here.
But the correct count should be total no. of records(excluding trailer record). So we can resolve this by subtracting only 1
You're right. The sort job provided above assumes the actual count to be the total number of detail records. If you need the header also, you may replace the code to subtract +1 instead of +2.
Quote:
Count in trailer is right justified while our count is left justified
I am not sure what you meant by this. Your initial post said "2-10 - Count (right justified - no leading zeros)", but the count in the sample input in your latest post is left justified.
WER164B 8,944K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 0 BYTES RESERVE REQUESTED, 3,124,440 BYTES USED
WER146B 20K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I SORTIN : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER257I INREC RECORD LENGTH = 89
WER238I POTENTIALLY INEFFICIENT USE OF INREC
WER110I HEADER : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER110I DETAIL : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER110I TRAILER : RECFM=FB ; LRECL= 80; BLKSIZE= 27920
WER405I HEADER : DATA RECORDS OUT 1; TOTAL RECORDS OUT 1
WER405I DETAIL : DATA RECORDS OUT 5; TOTAL RECORDS OUT 5
WER405I TRAILER : DATA RECORDS OUT 0; TOTAL RECORDS OUT 0
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER461A SORTOUT/OUTFIL DATA SET CONTAINS NO DATA RECORDS
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Quote:
I am still getting abend.
What abend are you getting? Mention the abend code or post the abend messages. I tried executing the code above, but I am getting an RC=16
as expected. May be this has something to do with your site settings.
My bad...this should not have gone this far...!!!
Actually was calling a customized proc in next step which would abend the job if RC>4.
Syam,
That parm "NORC16" is used when the default in one's system/installation for RC16 is ABE. Anyways, in my case its well set to NOABE. So need to do that. The trivial issue has stated above.