Validating a word in SORT in fixed positions



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

Validating a word in SORT in fixed positions

Postby rockstar2020 » Mon Jan 12, 2015 9:06 pm

Hello All,

First of thanks for all your help in every topic. I'm trying to achieve the below requirement using JCL without writing a program.
As you can see CAUGHT will be in either of 3 fixed positions for a group, between 001 to 002 or 001 to 003. it will b mostly in 002 or 003 and only once or it maynot available for that group.
If CAUGHT is seen in any one of fixed poostions in 002 or 003 in that group, i just want to write the name to the o/p, (i.e) LISA, TINA, RAGG in the below example and neglect MATT and DINO as they dont have CAUGHT.

INPUT CODE -
    001AAALISA    MATHS  MATHS
    002BBBLISA           MATHS  CAUGHT     
    001AAATINA    PHYSI  PHYSI
    002BBBTINA           PHYSI                   CAUGHT
    001AAAMATT    CHEM   CHEM
    002BBBMATT           CHEM       
    003BBBMATT                       
    001AAADINO    MATHS  MATHS
    002BBBDINO           MATHS   
    001AAARAGG    BIOLO  BIOLO
    002BBBRAGG           BIOLO                                  CAUGHT
    003BBBRAGG           


expected o/p
LISA
TINA
RAGG
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Validating a word in SORT in fixed positions

Postby BillyBoyo » Mon Jan 12, 2015 10:05 pm

If the CAUGHTs don't require further validation (if the can only appear correctly to your requirement) then you can use a field-type of SS to do a sub-string search.

You can do that on INCLUDE/OMIT (bot COND and on OUTFIL) or on IFTHEN=(WHEN=(logical expression).

For here, an OUTFIL INCLUDE with a BUILD for the name field. OUTFIL INCLUDE=(startoffirstfield,lenghtofallthreefields,SS,EQ,C'CAUGHT')
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Validating a word in SORT in fixed positions

Postby rockstar2020 » Tue Jan 13, 2015 1:49 am

Thank you Bill. I wrote all the records having CAUGHT to one file. I did that now. I used OUTFIL INCLUDE, BUILD for this.

However I need to write all the records that doesnt have CAUGHT to another file. IS it possible in the same step?
rockstar2020
 
Posts: 32
Joined: Wed Jan 08, 2014 3:51 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Validating a word in SORT in fixed positions

Postby BillyBoyo » Tue Jan 13, 2015 3:49 am

A second OUTFIL, naming a different DD, and specify SAVE for it. All records which aren't written to another OUTFIL will be written to the OUTFIL with SAVE on.
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