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
 

 

what are different options to sort records?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
abhi.5873

New User


Joined: 28 Jan 2013
Posts: 8
Location: India

PostPosted: Mon Jan 28, 2013 10:06 am    Post subject: what are different options to sort records?
Reply with quote

Hi ,

I am writing a Cobol db2 program.

I have 3 different queries with same column names.

After fetch the data i need to sort with 3 columns.

What are different options to do this?

Could please tell ?
Back to top
View user's profile Send private message

chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Mon Jan 28, 2013 12:33 pm    Post subject:
Reply with quote

Hi,

Your requirement is not clear..

It will be great if you elaborate on it.

In any case are you going to execute those three queries then you can use UNION fro those three queries.

Regards,

Chandan
Back to top
View user's profile Send private message
abhi.5873

New User


Joined: 28 Jan 2013
Posts: 8
Location: India

PostPosted: Mon Jan 28, 2013 12:43 pm    Post subject:
Reply with quote

Hi Chandan,

I am extarcting some details from 1st query and using this values i am extracting details from 2 nd query.

while extraction i have column quantity if it is sufficent then i won't go to 3 query if it is not i will go to third query and fetch the data after get the data i need to sort by three column called trade date and settlement date and insert timestamp then i need to proceess those records with some logic.

I want to know what athe different apporach to do this.
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Mon Jan 28, 2013 1:44 pm    Post subject:
Reply with quote

Hi,

Still its not clear..

You are going to use data from only 3rd or 2nd query for final processing or you will be using data from 1st query also?

It will be great if you elaborate with sample input and sample output

It will help people here to answer/guide correctly

Regards,
Chandan
Back to top
View user's profile Send private message
abhi.5873

New User


Joined: 28 Jan 2013
Posts: 8
Location: India

PostPosted: Mon Jan 28, 2013 1:52 pm    Post subject:
Reply with quote

Yes correct i will use only 2 and 3 query results

for example from 1 st quert i get the data as below

id trd-date settle-date quantity timestamp
1 23 jan 30 jan 3000 10:11:23:55555
3 25 jan 30 jan 4000 10:23:11:66666


from 2 nd query i will get
id trd-date settle-date quantity timestamp
2 24 jan 30 jan 3000 10:11:23:55555
4 26 jan 30 jan 4000 10:23:11:66666


desired output is
id trd-date settle-date quantity timestamp
1 23 jan 30 jan 3000 10:11:23:55555
2 24 jan 30 jan 3000 10:11:23:55555
3 25 jan 30 jan 4000 10:23:11:66666
4 26 jan 30 jan 4000 10:23:11:66666
Back to top
View user's profile Send private message
chandan.inst

Active User


Joined: 03 Nov 2005
Posts: 269
Location: Mumbai

PostPosted: Mon Jan 28, 2013 5:31 pm    Post subject:
Reply with quote

Hi,

As you will be using outputs from two different queries then why to write query output as it is in output file first and then sort entire output file in different step?

Else let us know what is the criteria you will like to select dta from query 2 and query 3?

Regards,
Chandan
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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