GROUP BY and ORDER BY for IMS DB?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm

GROUP BY and ORDER BY for IMS DB?

Post by RaOne »

Hi,

Do we have something similar in IMS like DB2's GROUP BY and ORDER BY for IMS DB?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by nicc »

No. You have to program it yourself.
Regards
Nic
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: GROUP BY and ORDER BY for IMS DB?

Post by Anuj Dhawan »

nicc is correct. GROUP BY and ORDER BY works on columns and rows while there are no column and rows in IMS. You might use GU, GN but none can be termed as equivalent of these.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne »

Then if I have to something which needs to sort the result on a given value how will I do it in IMS commands?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by nicc »

You cnnot becuse there is no IMS command to do such a thing. You have to either pass the data to the next step in the job to sort it or invoke sort from your program or write your own sort routine within your program.

An alternative, if your= have DB2 available to you, is to load the data into a temporary DB2 table as you extract it from the IMS database and then use SQL facilities to read the data back from the DB2 table.
Regards
Nic
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne »

Thanks nicc.

I shall prefer using my own sort routine as getting values from IMS and loading to DB2 would be very expensive than the work required. Thanks for your valuable inputs.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: GROUP BY and ORDER BY for IMS DB?

Post by Anuj Dhawan »

IMS stores the data in segments. The smallest unit which you can get from the IMS database is a segment. Segments have fields, defined for your system. If you want to perform some operation on the field, the only option you are left with is to play with fields... in other words, and as far this thread is concerned, you'll have to write your own sort routine.


An after thought: There is anEXEC DLI interface available for IMS, I have not checked the details but it should also work on the segment level but it might worth checking if it can allow you to have something similar like EXEC SQL ... ORDER BY; but it's highly unlikely.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne »

Anuj Dhawan wrote:IMS stores the data in segments. The smallest unit which you can get from the IMS database is a segment. Segments have fields, defined for your system. If you want to perform some operation on the field, the only option you are left with is to play with fields... in other words, and as far this thread is concerned, you'll have to write your own sort routine.


An after thought: There is anEXEC DLI interface available for IMS, I have not checked the details but it should also work on the segment level but it might worth checking if it can allow you to have something similar like EXEC SQL ... ORDER BY; but it's highly unlikely.
Thanks Anuj. I could find an equivalent of ORDER BY.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: GROUP BY and ORDER BY for IMS DB?

Post by Anuj Dhawan »

RaOne wrote:
Anuj Dhawan wrote:IMS stores the data in segments. The smallest unit which you can get from the IMS database is a segment. Segments have fields, defined for your system. If you want to perform some operation on the field, the only option you are left with is to play with fields... in other words, and as far this thread is concerned, you'll have to write your own sort routine.


An after thought: There is anEXEC DLI interface available for IMS, I have not checked the details but it should also work on the segment level but it might worth checking if it can allow you to have something similar like EXEC SQL ... ORDER BY; but it's highly unlikely.
Thanks Anuj. I could find an equivalent of ORDER BY.
That's great!. Can you please share a link to the reference you might have?
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne »

There is a mistake, I wanted to say NOT. I could NOT find an equivalent of ORDER BY.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”