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: 83
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

Senior Member


Joined: 29 Apr 2008
Posts: 2018
Location: USA

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: 83
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 question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
No new posts Cant find hex value using IFTHEN=(WHEN DFSORT/ICETOOL 12
No new posts Getting OUTREC - SHORT REC error for ... DFSORT/ICETOOL 12
Search our Forums:

Back to Top