Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Split single i/p line into multiple lines based on criteria

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

New User


Joined: 10 Nov 2015
Posts: 21
Location: USA

PostPosted: Wed Feb 27, 2019 12:47 am    Post subject: Split single i/p line into multiple lines based on criteria
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    Post subject:
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: 21
Location: USA

PostPosted: Wed Feb 27, 2019 11:43 pm    Post subject: Split single i/p line into multiple lines based on criteria
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    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 Dynamically split large DSN list into... Ghellar CLIST & REXX 7 Tue Sep 17, 2019 8:24 pm
No new posts Need to fetch data from database base... Satandale COBOL Programming 8 Sun Sep 08, 2019 12:01 am
No new posts Concatenate two files of variable rec... Thiru S DFSORT/ICETOOL 3 Wed Aug 21, 2019 11:53 pm
No new posts Select based on a range from a differ... sergeyken SYNCSORT 2 Fri Aug 16, 2019 12:37 am
This topic is locked: you cannot edit posts or make replies. Select based on a range from a differ... vamsimul SYNCSORT 13 Tue Aug 13, 2019 12:36 pm

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