Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

To split the record conditionally

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

New User


Joined: 22 Feb 2016
Posts: 5
Location: India

PostPosted: Mon Feb 22, 2016 7:52 pm    Post subject: To split the record conditionally
Reply with quote

Hello,

I was working on a task where I need to split a record into multiple records conditionally. Below is the example of the requirement

Input records
abcdefghij12345fghij12345klmno90876pqrst12345uvwxy12345zabcd76543efghi
qwertyuiop12345abcde12345fghij67890klmno12345pqrst57876uvwxy12345zfghi
abcdefghij12345fghij12345klmno12345pqrst12345uvwxy12345zabcd12345efghi
qwertyuiop12345abcde12345fghij12345klmno12345pqrst12345uvwxy12345zfghi

As you might have noticed input records would be in the copybook format as below

Code:

01 ws-inrec.
  05 ws-text1   pic x(10).
  05 ws-occ  occurs 5 times.
    07 ws-num1  pic 9(5).
    07 ws-text2  pic X(5).


Now the task is to check if the ws-num1 in above copybook is 12345, if so, then we have to write it in the output record for each occurrence. In the above example on reading first record the output should have 4 records as it has four occurrences of 12345, as below.

abcdefghij12345fghij
abcdefghij12345klmno
abcdefghij12345uvwxy
abcdefghij12345zabcd

Output record should have data as below.

Code:

01 ws-inrec.
  05 ws-text1   pic x(10).
  05 ws-num1  pic 9(5).
  05 ws-text2  pic X(5).


I have already worked this in Cobol, but i'm curious to know if there is any feasible way to accomplish this in dfsort. I would also like to mention, on search I found Link
which shows a similar task. But I felt that logic might be too lengthy in this case.

Let me know if you are looking for any other information.

Thanks,
Back to top
View user's profile Send private message

Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Mon Feb 22, 2016 8:59 pm    Post subject:
Reply with quote

probably 2 or 3 statements..
on inrec include only those records that you need
buid your outfile using only the fields you need.
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Mon Feb 22, 2016 9:06 pm    Post subject: Reply to: To split the record conditionally
Reply with quote

Hint: Use OUTFIL slash '/' operator.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Feb 22, 2016 9:19 pm    Post subject: Reply to: To split the record conditionally
Reply with quote

Use ICETOOL's RESIZE operator, with a USING.

In the USING use INREC BUILD to make a long record where each occurrence is prefixed by the key.

in OUTFIL, use INCLUDE= for the key you want.
Back to top
View user's profile Send private message
Lakshmi Prakash

New User


Joined: 22 Feb 2016
Posts: 5
Location: India

PostPosted: Tue Feb 23, 2016 7:42 pm    Post subject:
Reply with quote

Thank you Bill, your solution worked perfectly well. icon_biggrin.gif icon_biggrin.gif icon_smile.gif
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 update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us