IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

OUTREC w. several IFTHEN variants


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Auryn

New User


Joined: 11 Jan 2006
Posts: 67
Location: Lower Saxony (DE)

PostPosted: Thu Jul 19, 2018 8:11 pm
Reply with quote

Hi there again,

this time I am quite a bit desperate trying to transform data with the ICETOOL:
I’ve got an old dataset whose content at some positions is very ‘crazy’. The good thing is the datasets recfm is fix (100 bytes) and its columns are pretty good to handle with COBOL or ICETOOL.
But the data type of some columns depend on other columns i.e. in some cases the content of one column is binary, in some cases packed decimal, in some other cases... Or a pd-coded date column does not contain the century and I’d like to transform it in a ZD date with leading century depending on the date (i.e. date gt “181231 => century := ‘19’, otherwise century := ‘20’, here »13,04,PD,GT,181231«).
I’m trying to transform that input dataset but I’m not successful using the OUTREC IFTHEN clauses.
I was successful when I coded one IFTHEN clause for each combination of all variants of column A and all variants of column B and all variants of …
Code:
OUTREC IFTHEN=(WHEN=(17,02,CH,NE,X'0033',AND,
                     13,04,PD,GT,181231),
              BUILD=(C'HFKEYS',                   /* col ALPHA
                     17,02,BI,TO=ZD,LENGTH=5,     /* col BRAVO 1
                     19,10,                       /* col BRAVO 2a
                     C'  ',                       /* col BRAVO 3a
                     C'  ',                       /* col CHARLIE
                     C'19',                       /* col DELTA 1a
                     13,04,PD,TO=ZD,LENGTH=6,     /* col DELTA 2
                     C'INITIAL ',                 /* col ECHO
                     C'|',                        /* separating constant
                     01,100)),                    /* complete input record
       IFTHEN=(WHEN=(17,02,CH,NE,X'0033',AND,
                     13,04,PD,LE,181231),
              BUILD=(C'HFKEYS',                   /* col ALPHA
                     17,02,BI,TO=ZD,LENGTH=5,     /* col BRAVO 1
                     19,10,                       /* col BRAVO 2a
                     C'  ',                       /* col BRAVO 3a
                     C'  ',                       /* col CHARLIE
                     C'20',                       /* col DELTA 1a
                     13,04,PD,TO=ZD,LENGTH=6,     /* col DELTA 2
                     C'INITIAL ',                 /* col ECHO
                     C'|',                        /* separating constant
                     01,100)),                    /* complete input record
       IFTHEN=(WHEN=(17,02,CH,EQ,X'0033',AND,       /* col ALPHA
                     13,04,PD,GT,181231),
              BUILD=(C'HFKEYS',                   /* col ALPHA
                     17,02,BI,TO=ZD,LENGTH=5,     /* col BRAVO 1
                     19,03,PD,TO=ZD,LENGTH=5,     /* col BRAVO 2b
                     22,07,                       /* col BRAVO 3b
                     C'  ',                       /* col CHARLIE
                     C'19',                       /* col DELTA 1a
                     13,04,PD,TO=ZD,LENGTH=6,     /* col DELTA 2
                     C'INITIAL ',                 /* col ECHO
                     C'|',                        /* separating constant
                     01,100)),                    /* complete input record
       IFTHEN=(WHEN=(17,02,CH,EQ,X'0033',AND,
                     13,04,PD,LE,181231),
              BUILD=(C'HFKEYS',                   /* col ALPHA
                     17,02,BI,TO=ZD,LENGTH=5,     /* col BRAVO 1
                     19,03,PD,TO=ZD,LENGTH=5,     /* col BRAVO 2b
                     22,07,                       /* col BRAVO 3b
                     C'  ',                       /* col CHARLIE
                     C'20',                       /* col DELTA 1b
                     13,04,PD,TO=ZD,LENGTH=6,     /* col DELTA 2
                     C'INITIAL ',                 /* col ECHO
                     C'|',                        /* separating constant
                     01,100))                     /* col ALPHA

This sample is not complete and doesn’t represent all variants. But it already looks very confusing icon_evil.gif

I’m looking for a solution where I prepare each constant or variable part of the record one by one.
I’m experimenting with WHEN=INIT, WHEN=ANY and WHEN=NONE clauses, I’m experimenting with HIT=NEXT clauses, I’m experimenting with a clause WHEN=(01,08,EQ,C’CONSTVAL’) which is a constant value in the input dataset at this position for all variants of records, …

How can I combine several constant and variable kinds of transformation and concatenate the results of each single column transformation to a new outrec?

Thank you all for your hints

Auryn
Back to top
View user's profile Send private message
sergeyken

Active Member


Joined: 29 Apr 2008
Posts: 924
Location: Maryland

PostPosted: Thu Jul 19, 2018 9:42 pm
Reply with quote

If you are using WHEN=INIT,BUILD=(common formatting),...
then you can use subsequent WHEN=(condition),OVERLAY=(changed fields),HIT=NEXT
but keep in mind that every (condition), must refer to the previously reformatted fields of the record already updated by preceeding WHEN= groups.
Back to top
View user's profile Send private message
Auryn

New User


Joined: 11 Jan 2006
Posts: 67
Location: Lower Saxony (DE)

PostPosted: Fri Jul 20, 2018 7:34 pm
Reply with quote

sergeyken wrote:
If you are using WHEN=INIT,BUILD=(common formatting),...
then you can use subsequent WHEN=(condition),OVERLAY=(changed fields),HIT=NEXT
but keep in mind that every (condition), must refer to the previously reformatted fields of the record already updated by preceeding WHEN= groups.


Hey great, it works.
Had some troubles with ambiguous WHEN-clauses but found their reasons.
Thank you very much.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts IFTHEN : Is there a better way? DFSORT/ICETOOL 7
No new posts SEQNUM with TRA=ETOA in OUTREC SYNCSORT 5
No new posts Outrec IFTHEN builds data in wrong po... DFSORT/ICETOOL 6
No new posts IFTHEN HIT=NEXT BUILR should create m... DFSORT/ICETOOL 5
No new posts DO we have alternate syntax for IFTHEN? Compuware & Other Tools 8
Search our Forums:

Back to Top