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
 

 

Repeating unique id for next particular set of rows

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

New User


Joined: 15 Aug 2009
Posts: 29
Location: Chennai

PostPosted: Thu Oct 03, 2013 4:43 am    Post subject: Repeating unique id for next particular set of rows
Reply with quote

Hi

My Input looks like:

Code:
1           12                     30
-----------------------------------
74.02    AW8791            XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
                                      XXXXXXXXXXXXXXX
         1004215735        XXXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX
                                         
67.53    W23435           XXXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX
                                     
                                     XXXXXXXXXXXXXXX
         1004162939        XXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX
                                     XXXXXXXXXXXXXXX

My expected out put is

Code:
1           12                     30
-----------------------------------
             AW8791           XXXXXXXXXXXXXXX
             AW8791           XXXXXXXXXXXXXXX
             AW8791           XXXXXXXXXXXXXXX
             AW8791           XXXXXXXXXXXXXXX
             1004215735    XXXXXXXXXXXXXXX
             1004215735    XXXXXXXXXXXXXXX
             1004215735    XXXXXXXXXXXXXXX
             1004215735    XXXXXXXXXXXXXXX
                                         
             W23435           XXXXXXXXXXXXXXX
             W23435           XXXXXXXXXXXXXXX
             W23435           
             W23435           XXXXXXXXXXXXXXX
             1004162939    XXXXXXXXXXXXXXX
             1004162939    XXXXXXXXXXXXXXX
             1004162939    XXXXXXXXXXXXXXX
             1004162939    XXXXXXXXXXXXXXX

Each group has eight rows followed by spaces with 2 unique id. So each unique id starting from position 12 needs to be printed for next 3 lines in same position

I tried using some function using sort but no got.

Please suggest
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 03, 2013 4:48 am    Post subject: Reply to: Repeating unique id for next particular set of row
Reply with quote

Look at the smart DFSORT trick "Include or omit groups of records" to use WHEN=GROUP and remove the INCLUDE on OUTFIL and use BUILD to get the required output.

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
Back to top
View user's profile Send private message
lagneshp

New User


Joined: 15 Aug 2009
Posts: 29
Location: Chennai

PostPosted: Sat Oct 05, 2013 4:09 am    Post subject:
Reply with quote

Thank you Skolusu...

I used below sort card

SORT FIELDS=COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(12,1,CH,NE,C' '),
PUSH=(283:ID=8))
OUTREC BUILD=(1,290)


It worked well.


Thanks,
Lagnesh.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Sat Oct 05, 2013 4:49 am    Post subject: Reply to: Repeating unique id for next particular set of row
Reply with quote

Thanks for letting us know and showing what you used.

What happened when you run your sample input? Don't you need to do something with the blank lines?

If you actually only have four records in each group, for certain, you can also consider RECORDS=4 on the WHEN=GROUP, which will leave the blank lines (if there are any) undisturbed.
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 DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Can we use OPTIMIZE FOR 1 ROWS for fe... cvijay784 DB2 1 Fri Aug 05, 2016 11:56 am


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