Page 1 of 1

Double "IF" statement in SORT?

PostPosted: Fri Jun 18, 2010 7:28 pm
by schneiderusa
I have a VB flat file and need to make this small change. I can write a COBOL program but is it possible to do it in SORT?

IF FLD1(1:3) = '111' and FLD2(81:12) = 'XXXXXXXXXXXX'
CHANGE FLD2(81:12) TO 'YYYYYYYYYYYY'

Thanks,
Gary.

Re: Double "IF" statement in SORT?

PostPosted: Fri Jun 18, 2010 9:34 pm
by skolusu
schneiderusa ,

Since your input is a VB file, you need to consider the RDW as the actual data starts at position 5. Use the following DFSORT control cards which will give you the desired results

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  INREC IFTHEN=(WHEN=(05,3,CH,EQ,C'111',AND,           
                      85,12,CH,EQ,C'XXXXXXXXXXXX'),   
  OVERLAY=(85:C'YYYYYYYYYYYY'))                       
//*

Re: Double "IF" statement in SORT?

PostPosted: Sat Jun 19, 2010 12:47 am
by schneiderusa
Thanks a lot.