HI All,
I have one sort card which will validate the binary and PD fields for less than 0 and non numeric(for PD) and write the records in the output file with description.Now its working fine if each record has one invalid field.
Now my requirement is if any one record has 2 invalid fields it should be written 2 times in the output file with description(negative or non-numeric).
Also please help me out writing the header for the above records.I am using the below one
Code:
OUTFIL REMOVECC,
HEADER1=('KEY FIELD ********************************************',
'******DISCREPANT********************ISSUE TYPE
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
seethaRam10,
There are a couple of problems with your INCLUDE condition. If you really want to test for negative numbers then you need to use FI format instead of BI format.
Looking at your OUTREC statements, you are only validating 5 fields. Why can't you include only records which would be true for those conditions?
If you want to evaluate more than 1 field on the same record , you need to use HIT=NEXT on each of the IFTHEN statements.
I have pasted only part of my code to conserve the space .Actually I am validating the all the fields in my sort card..
I have tried HIT=NEXT but it is building the statement of last IFTHEN.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Telling us what you did that didn't work without explaining what you're trying to do is really not very helpful.
You need to start over and explain clearly what it is you're trying to do.
Please show an example of the records in your input file (relevant fields only) and what you expect for output. Include the cases that aren't working. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input files.
Also, run this job and show the //SYSOUT messages you receive, so I can see what level you're at:
Please find below the //SYSOUT messages for the job you have given
Code:
SYNCSORT LICENSED FOR CPU SERIAL NUMBER 40BE0, MODEL 2817 735
SYSIN :
OPTION COPY
WER276B SYSDIAG= 2467164, 4229465, 4229465, 1889100
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
Coming to my requirement:
I have a file having records with 4 comp and 6 comp-3 fields.I have to validate these fields for negative,non-numeric(for PD) and build the output as a report showing the discrepancy.
Please find the sample records in my file.
Code:
BI BI BI BI PD PD PD PD
(1-2) (3-4) (31-32) (56-57) (118-123) (124-129) (164-168) (169-170)
-7 -71 0 2010 33000.00 0 0 20
7 -72 0 -2010 50000.00 0 0 90
The record format is FB and record length is 333 bytes.
I had used the HIT=NEXT option for IFTHEN conditions ,its validating the next field of the same record but overriding on the same record in the output.
Please let me know is there any way to build the same record as many times as the no. of invalid fields in it(2 invalid fields means it should print 2 times).
Also to count the records based on the invalid fields.
Code:
(INVALID RECS WITH DTE-MONTH 1
(INVALID RECS WITH DTE-YEAR 1)
Please let me know if you need any more details
Thanks for your time
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
Quote:
Please let me know is there any way to build the same record as many times as the no. of invalid fields in it(2 invalid fields means it should print 2 times). Also to count the records based on the invalid fields.
It is true that using HIT=NEXT will make the subsequent IFTHEN checks also even if one IFTHEN condition is satisfied.
But YOU need to take care of not losing the data already OVERLAYed at some position by NOT giving the same output position in all the IFTHEN OVERLAYs.
It is not clear how your expected output should look like. It might help if you post here the expected output records for a few sample input data records.
If i understood your requirement correctly, What you could possibly do is to try writing the output in multiple files using OUTFIL statments as shown below.
OUTFIL FILES=01,INCLUDE=(1,2,FI,LT,0),
HEADER1=('INVALID MONTH'),
OUTREC=(1:1,2,26:C'MONTH',35:C'NEGATIVE'),
TRAILER1=(1:C'INVALID RECORDS WITH DTE-MONTH:',
35:COUNT=(TO=ZD,LENGTH=8))
OUTFIL FILES=02,INCLUDE=(3,2,FI,LT,0),
HEADER1=('INVALID NUMSEG'),
OUTREC=(3:1,2,26:C'NUM SEG',35:C'NEGATIVE'),
TRAILER1=(1:C'INVALID RECORDS WITH NUM SEG :',
35:COUNT=(TO=ZD,LENGTH=8))
INVALID NUMSEG
6- NUM SEG NEGATIVE
5- NUM SEG NEGATIVE
4- NUM SEG NEGATIVE
3- NUM SEG NEGATIVE
2- NUM SEG NEGATIVE
1- NUM SEG NEGATIVE
INVALID RECORDS WITH NUM SEG : 00000006
I hope this will help you. If this is not what you required, as others told please elaborate the requirement.