How to use OUTREC in IFTHEN=(WHEN



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

How to use OUTREC in IFTHEN=(WHEN

Postby Ramsee » Thu Jul 10, 2014 6:29 pm

Hi All,

Warm greeting!!

I am trying to update the 190 column as ' ' (Two blank spaces) by validaing the 1st position of the file using the following sortcard:
Input :
1234567      11  20140101
1234568      12  20140102
1234569           20140103

SYSIN :
OPTION COPY
OUTREC IFTHEN=(WHEN=(1,7,CH,EQ,C'1234567'),OVERLAY=(10:C' ')), -
IFTHEN=(WHEN=NONE,BUILD=(1:1,20))

Expected Output:
1234567           20140101
1234568     12  20140102
1234569     01  20140103    (01 is not present in the input)

In the above code, i am facing an issue that remaining records (other than "1234567" in position 1) are filled with junk values.
I need to write the unmatched records as it is.

Please suggest me a correct sortcard.

Thanks
Ramsee
 
Posts: 25
Joined: Wed Nov 20, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to use OUTREC in IFTHEN=(WHEN

Postby BillyBoyo » Thu Jul 10, 2014 6:36 pm

What is the LRECL of your input? Not 20, is it? What do you want to do with that second IFTHEN=?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: How to use OUTREC in IFTHEN=(WHEN

Postby Ramsee » Thu Jul 10, 2014 6:39 pm

the second IF then is used to write the input record as it is for all the unmatched records.
Ramsee
 
Posts: 25
Joined: Wed Nov 20, 2013 6:08 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to use OUTREC in IFTHEN=(WHEN

Postby BillyBoyo » Thu Jul 10, 2014 6:47 pm

OK, I think you misunderstand how it works:

Record is read; INCLUDE/OMIT processing; INREC processing; SORT/MERGE processing (if not COPY); OUTREC processing; OUTFIL processing where records are written per OUTFIL; record is written to SORTOUT if DD present, and no OUTFIL for SORTOUT.

You don't need to do anything to get a record written (unless you want multiple output records from one input record). You sometimes need to do things (OMIT/INCLUDE COND=, OMIT=/INCLUDE=) to prevent records being written.

Remove that second IFTHEN (the the comma preceding it) and run again. If that doesn't give you what you want, show sample input, actual output and expected output, as well as the Sort Control Cards you used and the sysout from the step.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post