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

Split single i/p line into multiple lines based on criteria


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

New User


Joined: 10 Nov 2015
Posts: 44
Location: USA

PostPosted: Wed Feb 27, 2019 12:47 am
Reply with quote

Hi Team,

My mainframe PS input file is as below,

Code:
  Q2019-02-01


Requirement:

If column 3 in the input file contains Q then my output PS/PDS member should be static as shown below,
Code:

You are not eligible for asset tiering of brokerage accounts


If column 3 is Y the my output should be dynamic and contain multiple lines as shown below,
Code:

You are not eligible for asset tiering of brokerage accounts
You were were eligible till 2019-02-01.
Since you have been recently removed we want to give you another chance.
Please contact support team if any questions.


My attempt:

I tried using ICETOOL where i kept the verbiage "You are not eligible for asset tiering of brokerage accounts" in a HEADER field since its the first line for both output are same. It worked fine.

Code:
OUTFIL REMOVECC,                       
HEADER1=(1:'You are not eligible for asset tiering of brokerage accounts')



Now to get 2nd line partially i tried using below and worked fine.
Code:
OUTREC IFTHEN=(WHEN=(3,1,CH,EQ,C'Y'),                     
      BUILD=(C'You were were eligible till ',80:X))   


I am not sure of how to proceed to get the dyanamic 'YYYY-MM-DD' from input for 2nd line as well as 3rd and 4th line.

Any constructive suggestions are much appreciated.

Note: I have cooked up the verbiage and it has no relation to where I work. Thanks!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 27, 2019 4:27 am
Reply with quote

You could achieve this using a DFSORT step like this. Note that I have used dummy values, could be changed as per your actual requirement.
Code:
//STEP01 EXEC PGM=SORT                   
//SYSOUT   DD SYSOUT=*                   
//SORTIN   DD *                         
  Y2019-02-01                           
//SORTOUT  DD SYSOUT=*                   
//SYSIN    DD *                         
  SORT FIELDS=COPY                       
  OUTFIL IFTHEN=(WHEN=(3,1,CH,EQ,C'Q'), 
          BUILD=(C'ABCD')),             
         IFTHEN=(WHEN=(3,1,CH,EQ,C'Y'), 
          BUILD=(C'ABCD',/,C'PQRS',4,10))
Back to top
View user's profile Send private message
elixir1986
Warnings : 1

New User


Joined: 10 Nov 2015
Posts: 44
Location: USA

PostPosted: Wed Feb 27, 2019 11:43 pm
Reply with quote

Appreciate the constructive response. I tried below per your suggestion and it worked,

Code:
OPTION COPY                                         
OUTFIL IFTHEN=(WHEN=(3,1,CH,EQ,C'Y'),               
       BUILD=(1:C'LINE 1 VERBIAGE.',80:X,/,         
              1:C'LINE 2 VERBIAGE ',4,10,C'.',80:X,/,
       C'LINE 3 VERBIAGE.',80:X,/,                   
       C'LINE 4 VERBIAGE.',80:X)),                   
       IFTHEN=(WHEN=(3,1,CH,EQ,C'Q'),               
       BUILD=(1:C'LINE 1 VERBIAGE.',80:X)) 


When column 3 is Q, i got below output,
Code:
LINE 1 VERBIAGE.

When column 3 is Y, i got below output,
Code:
LINE 1 VERBIAGE.           
LINE 2 VERBIAGE 2019-02-01.
LINE 3 VERBIAGE.           
LINE 4 VERBIAGE.     
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top