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

IMS DB2 Unload


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

New User


Joined: 26 Jul 2017
Posts: 2
Location: India

PostPosted: Mon Apr 22, 2019 8:26 pm
Reply with quote

Hi,

There is a requirement where i am trying to pull the segments present in IMS database on the few conditions, and has to be formatted in the required format. All the segments it is pulling up correctly, however there is an requirement where all the fields have to be formatted as per one file layout, where in one field is having three occurrences, below is the sample sort card with the expected outcome and the output i got.
Please help me with the sort card.



Input:

Code:
----+----0----+----
01 A134 B7154 C8796
05 A135 B7890 C0987
07 A136 B5469 C2564
07 A137 B4567 C2130
07 A138 B6545 C3654


Output:

Code:
----+----1----+----2----+----3----+----4
01 A134 B7154 C8796 A134
05 A135 B7890 C0987 A134 A135
07 A136 B5469 C2564 A134 A135 A136
07 A137 B4567 C2130 A134 A135 A137 A137 
07 A138 B6545 C3654 A134 A135 A138 A138

Expected Output:

Code:
----+----1----+----2----+----3----+----4----+----5
01 A134 B7154 C8796 A134
05 A135 B7890 C0987 A134 A135
07 A136 B5469 C2564 A134 A135 A136
07 A137 B4567 C2130 A134 A135 A136 A137
07 A138 B6545 C3654 A134 A135 A136 A137 A138


Sort Card:

Code:
INREC IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'01'),
        PUSH=(25:4,4)),
 
      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'05'),
       PUSH=(31:4,4)), 
 
      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'07'),
       PUSH=(36:4,4)),           

      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'07'),
       PUSH=(42:4,4)),

      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'07'),
       PUSH=(48:4,4))
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Tue Apr 23, 2019 2:07 pm
Reply with quote

Please post in therelevant section of the forum - you have a sort problem, not an IMS problem. Topic moved. (If you have Syncsort then let us know and it will be moved to that forum.)

When presenting code, data, control statements please use the Code button in the Reply editor.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Tue Apr 23, 2019 5:53 pm
Reply with quote

kshkumar2231 wrote:
Sort Card:

Code:
INREC IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'01'),
        PUSH=(25:4,4)),
 
      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'05'),
       PUSH=(31:4,4)), 
 
      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'07'),
       PUSH=(36:4,4)),           

      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'07'),
       PUSH=(42:4,4)),

      IFTHEN=(WHEN=GROUP,                                   
       BEGIN=(1,2,CH,EQ,C'07'),
       PUSH=(48:4,4))

You do not understand the idea of grouping records while sorting.

First of all, in your case you need to use WHEN=GROUP,KEYBEGIN=(1,2),PUSH=(48:SEQ=2) to differentiate between sequential lines within the same group, like multiple '07's numbered as '01', '02', '03'...

Next, you may need some sophisticated IFTHEN=(WHEN=…), but initially you need to read carefully about GROUP in SORT.
Back to top
View user's profile Send private message
kshkumar2231

New User


Joined: 26 Jul 2017
Posts: 2
Location: India

PostPosted: Wed Apr 24, 2019 11:47 pm
Reply with quote

Hi Nick, Sergeyken

Thanks for your response.
My bad, I should have kept the title correctly.

Nick,
I have tried putting sequence number to differentiate the repetitive record, having multiple values, however the main challenge over here is to write all the pushed record in a single rows i. e in the last row and then by putting include condition get the last row to proceed further, where it has to be written as per file layout.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Apr 25, 2019 1:16 am
Reply with quote

Who is "Nick"?
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 Load new table with Old unload - DB2 DB2 6
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Multiple table unload using INZUTILB DB2 2
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts DB2 Table - Image copy unload IBM Tools 2
Search our Forums:

Back to Top