My output file should contain only records which has non-numeric value in Field 5 or the records which has same value in Field 6
It's not clear what you mean by this. What is the length of field5 and field6? What do you consider to be a "non-numeric"? Some of the fields have embedded blanks, some have / and -, some have trailing blanks. What are the "rules" for determining if the field is "non-numeric"? Is 11111 a "non-numeric" because it has trailing blanks?
You say the output field should contain records which have the same value in Field 5 and Field6. The fourth record meets that criteria, but you don't show it in your output example. Why? Actually all of your values have the same digits in field5 and field6, so do the fields have to match exactly (85170535 and 85170535) or can just the digits match (8 561 8659/ and 85618659)?
Before anyone can help you, you need to do a much better job of explaining the "rules" you want to use for including records, and you need to show a better example of input and output. Also, what is the RECFM and LRECL of your input file?
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
I probably should have waited for TS to post more info, but figured that if the problem was being worked over the weekend and a few lines of COBOL might help, i'd post them. I made the mistake of believing that the data was not a good sample and under-coded coded accordingly .
To answer your question, '1111 ' will test not numeric - i made up this little test to demonstrate a few situations and:
05 A PIC X(7) VALUE '1111 '.
05 B PIC X(7) VALUE '1 11111'.
05 C PIC X(7) VALUE '1111111'.
05 D PIC X(7) VALUE '111111A'.
05 E PIC X(7) VALUE ' 1111'.
05 F PIC X(7) VALUE ' '.
IF A NOT NUMERIC DISPLAY 'A NOT NUMERIC ' A.
IF B NOT NUMERIC DISPLAY 'B NOT NUMERIC ' B.
IF C NOT NUMERIC DISPLAY 'C NOT NUMERIC ' C.
IF D NOT NUMERIC DISPLAY 'D NOT NUMERIC ' D.
IF E NOT NUMERIC DISPLAY 'E NOT NUMERIC ' E.
IF F NOT NUMERIC DISPLAY 'F NOT NUMERIC ' F.
A NOT NUMERIC 1111
B NOT NUMERIC 1 11111
D NOT NUMERIC 111111A
E NOT NUMERIC 1111
F NOT NUMERIC
If the data will contain leading/trailing spaces along with the digits, my example won't work as coded. If there might be a zoned decimal in the input, my little code will reject that as well. . . To handle the ZD or the leading/trailing spaces additional code would be needed in the COBOL program. Depending on what should happen with all spaces, other code would be required also (i.e. is that zero or not numeric?).
Here's a DFSORT/ICETOOL job that will do what I think you asked for.
I don't know the LRECL of your input file or the starting positions of the fields, so I assumed that your input file has LRECL=80, field 5 is in positions 46-57 and field 6 is in positions 64-75. You can change the job appropriately for your real LRECL and positions.
You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's SQZ function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see: