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
 
IMS DB2 Unload

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: IMS DB2 Unload
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: 2255
Location: Hampshire, UK

PostPosted: Tue Apr 23, 2019 2:07 pm    Post subject: Reply to: IMS DB2 Unload
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

Active Member


Joined: 29 Apr 2008
Posts: 633
Location: Maryland

PostPosted: Tue Apr 23, 2019 5:53 pm    Post subject: Re: IMS DB2 Unload
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    Post subject: Reply to: syncsort
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: 2255
Location: Hampshire, UK

PostPosted: Thu Apr 25, 2019 1:16 am    Post subject: Reply to: IMS DB2 Unload
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    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 Unload / Load Multiple tables neo4u DB2 8 Tue Nov 27, 2018 3:43 pm
No new posts Change NULL indicator in UNLOAD utility Khadhar Basha DB2 2 Fri Dec 15, 2017 3:01 pm
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
This topic is locked: you cannot edit posts or make replies. Need help in estimating space of unlo... ashek15 IMS DB/DC 12 Fri Apr 07, 2017 5:11 am
No new posts Best IMS DB Unload Utility jjabez10 IMS DB/DC 12 Thu Sep 22, 2016 11:15 pm

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