Page 1 of 1

multiple ifthens or build of output

PostPosted: Wed Dec 02, 2009 4:59 am
by speermb
I have an input file that I'm stripping data off and placing it in a different layout. I already have an IFTHEN for one field and now I have a new output field that will based on 2 different input fields.
I need to add the right before the 744X a 1 char field based on input position 56,1, and 95,2. This new 1 byte field will be C'1" when 56,1 = A and 95,2 = 01 it will be C'2' when 56,1 = C and 95,2 = DN. It will C'X' when it does not get marked.
This is what I have already. Is it possible to imbed this logic or do I have to create

  OUTFIL FNAMES=SORTOUT,IFTHEN=(WHEN=(93,1,CH,EQ,C'S'),                 
             BUILD=(1:1,8,C'Y',56,1,57,2,71,1,84,9,C'1',             
             104,04,CHANGE=(04,C'    ',                               
                               C'0000'),NOMATCH=(104,04),             
                    113,1,178,1,292,1,406,15,430,3,438,2,             
                    142,1,97,2,                                       
             441,03,CHANGE=(01,C'PRC',C'1',                           
                               C'PRS',C'2',                           
                               C'NPC',C'3',                           
                               C'PRM',C'4'),NOMATCH=(C' '),           
                    74,10,154,1,422,2,124,1,     
***can I just add the logic here some how?                     
                    745X)),                                           
     IFTHEN=(WHEN=(93,1,CH,EQ,C'T'),                                 
             BUILD=(1:1,8,C'Y',56,1,57,2,71,1,84,9,C'2',             
             104,04,CHANGE=(04,C'    ',                               
                               C'0000'),NOMATCH=(104,04),             
                    113,1,178,1,292,1,406,15,430,3,438,2,             
                    142,1,97,2,                                       
             441,03,CHANGE=(01,C'PRC',C'1',                           
                               C'PRS',C'2',                           
                               C'NPC',C'3',                           
                               C'PRM',C'4'),NOMATCH=(C' '),           
                    74,10,154,1,422,2,124,1,                         
***can I just add the logic here some how?
                    745X)),                                           
    IFTHEN=(WHEN=NONE,                                         
        BUILD=(1:1,8,C'Y',56,1,57,2,71,1,84,9,C'1',         
        104,04,CHANGE=(04,C'    ',                         
                          C'0000'),NOMATCH=(104,04),       
               113,1,178,1,292,1,406,15,430,3,438,2,       
               142,1,97,2,                                 
        441,03,CHANGE=(01,C'PRC',C'1',                     
                          C'PRS',C'2',                     
                          C'NPC',C'3',                     
                          C'PRM',C'4'),NOMATCH=(C' '),     
               74,10,154,1,422,2,124,1,     
***can I just add the logic here some how?               
               745X))                         


Or Do I have to do something like below requiring a much bigger control statement.

  OUTFIL FNAMES=SORTOUT,IFTHEN=(WHEN=(93,1,CH,EQ,C'S',and,56,1,ch,eq,c'A',and,95,2,ch,eq,c'01'),               
             BUILD=(1:1,8,C'Y',56,1,57,2,71,1,84,9,C'1',             
             104,04,CHANGE=(04,C'    ',                               
                               C'0000'),NOMATCH=(104,04),             
                    113,1,178,1,292,1,406,15,430,3,438,2,             
                    142,1,97,2,                                       
             441,03,CHANGE=(01,C'PRC',C'1',                           
                               C'PRS',C'2',                           
                               C'NPC',C'3',                           
                               C'PRM',C'4'),NOMATCH=(C' '),           
                    74,10,154,1,422,2,124,1,C'1'
                    744X)),                                 
  IFTHEN=(WHEN=(93,1,CH,EQ,C'S',and,56,1,ch,eq,c'C',and,95,2,ch,eq,c'DN'),               
             BUILD=(1:1,8,C'Y',56,1,57,2,71,1,84,9,C'1',             
             104,04,CHANGE=(04,C'    ',                               
                               C'0000'),NOMATCH=(104,04),             
                    113,1,178,1,292,1,406,15,430,3,438,2,             
                    142,1,97,2,                                       
             441,03,CHANGE=(01,C'PRC',C'1',                           
                               C'PRS',C'2',                           
                               C'NPC',C'3',                           
                               C'PRM',C'4'),NOMATCH=(C' '),           
                    74,10,154,1,422,2,124,1,C'2'
                    744X)),

Re: multiple ifthens or build of output

PostPosted: Wed Dec 02, 2009 11:15 pm
by Frank Yaeger
It's not clear to me what you want to do.

When you say
***can I just add the logic here some how?


I don't know what type of logic you want to add.

You can use HIT=NEXT in an IFTHEN clause to continue to the next IFTHEN clause when you get a hit. Look up HIT=NEXT in the book and see if it would help. There's also a WHEN=ANY clause

I need to add the right before the 744X a 1 char field ...


I don't see a 744X - I see a 745X. This just adds to the confusion.

If you need more help, please show an example of the records in your input file (relevant fields only) and what you want for output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file, and the starting position, length and format of each relevant field.