Page 1 of 1

Using a symbolic name in an INCLUDE statement

PostPosted: Thu Dec 18, 2014 3:54 am
by migusd
Hi guys,
is it possible to use a symbolic name in an include?
So far, my attempts are failing.

I am using symbolic names because most fields are variable length.
I want to compare only the first bytes of the field.

here is my code.
this is in symnames
CKEY,1,8
FLD2,%00
FLD3,%01
FLD4,%02
PIPE,'|'
BLNK,' '


and this is the actual code

  SYSIN :                                                                         
  * SORT FIELDS=COPY                                                               
    INREC PARSE=(FLD2=(ABSPOS=10,FIXLEN=8,ENDBEFR=BLNK),                           
                 FLD3=(FIXLEN=13,ENDBEFR=BLNK),                                   
                 FLD4=(FIXLEN=11,ENDBEFR=BLNK)),                                   
    BUILD=(CKEY,PIPE,FLD2,PIPE,FLD3,PIPE,FLD4,PIPE)                               
    SORT FIELDS=COPY                                                               
    INCLUDE COND=(FLD3,04,CH,EQ,C'RACF')                                           
  DATA DICTIONARY SYMBOLS SUBSTITUTED :                                           
  INREC PARSE=(%00=(ABSPOS=10,FIXLEN=8,ENDBEFR=C' '),%01=(FIXLEN=13,ENDBEFR=C' '),
  %02=(FIXLEN=11,ENDBEFR=C' ')),BUILD=(1,8,C'|',%00,C'|',%01,C'|',%02,C'|')       
  SORT FIELDS=COPY                                                                 
  INCLUDE COND=(%01,04,CH,EQ,C'RACF')                                             
                *                                                                 
  WER268A  INCLUDE STATEMENT : SYNTAX ERROR                                       
  WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000                                   


how can I fix this?

Thanks

Re: Using a symbolic name in an INCLUDE statement

PostPosted: Thu Dec 18, 2014 5:07 am
by BillyBoyo
A couple of problems. No matter the order you code them, they are going to run like this:

INCLUDE ....
INREC ....


If you look at the documentation of symbols, I doubt you'll find anything which will allow you to use them like that. You can't make the start position of a field "variable".

You can use a symbol in an INCLUDE/OMIT. You can't use it there. You can't use a PARSEd field, because INREC, the earliest point you can use PARSE, runs after INCLUDE/OMIT.

If you show a sample of your data, expected output and what it is you are trying to achieve, we may have some suggestions. You can't do it how you are attempting it.

Re: Using a symbolic name in an INCLUDE statement

PostPosted: Thu Dec 18, 2014 8:29 am
by migusd
thanks Billy,
I made a mistake when I swap the INCLUDE & INREC statements.

I think is better to do it in separate steps.

Thanks

Miguel

Re: Using a symbolic name in an INCLUDE statement

PostPosted: Thu Dec 18, 2014 8:47 am
by migusd
having said that,
what I was really after (or what I should have done) is to use the INCLUDE in the OUTFIL statement.
attempting that... with the symbolic reference...

think of data
date 2014-12-08
12345678 lucas racf38978 actionx
98765432 recorch3 window3 actiony
23456789 outhandle racf8978 actionz
87654321 zap linux387 actionx

I only care about the racf in third field.
not sure if the BUILD is necessary here.

so the end data should look like this
12345678|lucas|racf38978|actionx|2014-12-08|
23456789|outhandle|racf8978|actionz|2014-12-08|

but haven't finished. in fact, I started with an imcomplete model.
I guess I should go with the INREC IFWHEN=GROUP to get the date from header record first...
so... working on it...

Thanks Billy