GROUP BY and ORDER BY for IMS DB?

IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Previous topicNext topic

Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

GROUP BY and ORDER BY for IMS DB?

Post by RaOne » Fri Jun 17, 2016 3:25 pm

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: 597
Joined: Wed Apr 23, 2014 8:45 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by nicc » Fri Jun 17, 2016 3:33 pm

No. You have to program it yourself.


Regards
Nic

User avatar

Anuj Dhawan
Founder
Posts: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: GROUP BY and ORDER BY for IMS DB?

Post by Anuj Dhawan » Fri Jun 17, 2016 4:49 pm

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.


Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne » Mon Jun 27, 2016 2:33 pm

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: 597
Joined: Wed Apr 23, 2014 8:45 pm

Re: GROUP BY and ORDER BY for IMS DB?

Post by nicc » Mon Jun 27, 2016 3:04 pm

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


Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne » Mon Jun 27, 2016 3:16 pm

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: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: GROUP BY and ORDER BY for IMS DB?

Post by Anuj Dhawan » Tue Jun 28, 2016 6:05 pm

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.


Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne » Tue Jul 05, 2016 12:26 pm

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: 2624
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Zodiac: Sagittarius

Re: GROUP BY and ORDER BY for IMS DB?

Post by Anuj Dhawan » Tue Jul 05, 2016 2:07 pm

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.


Topic Author
RaOne
Registered Member
Posts: 27
Joined: Fri Aug 16, 2013 11:46 pm
Zodiac: Cancer

Re: GROUP BY and ORDER BY for IMS DB?

Post by RaOne » Thu Jul 07, 2016 12:30 pm

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



Previous topicNext topic

Return to “IMS DB/DC.”