Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
OUTREC w. several IFTHEN variants

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Auryn

New User


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

PostPosted: Thu Jul 19, 2018 8:11 pm    Post subject: OUTREC w. several IFTHEN variants
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 User


Joined: 29 Apr 2008
Posts: 367
Location: Maryland

PostPosted: Thu Jul 19, 2018 9:42 pm    Post subject:
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: 60
Location: Lower Saxony (DE)

PostPosted: Fri Jul 20, 2018 7:34 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to write 0 using outrec sprikitik SYNCSORT 3 Thu Oct 18, 2018 2:55 pm
No new posts OUTREC OVERLAY different to INCREC ge... Joerg.Findeisen SYNCSORT 8 Fri Apr 27, 2018 2:11 am
No new posts OUTREC with ALter Command scorp_rahul23 DFSORT/ICETOOL 1 Wed Nov 22, 2017 3:10 pm
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us