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

what are different options to sort records?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 275
Location: Mumbai

PostPosted: Mon Jan 28, 2013 12:33 pm
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
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: 275
Location: Mumbai

PostPosted: Mon Jan 28, 2013 1:44 pm
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
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: 275
Location: Mumbai

PostPosted: Mon Jan 28, 2013 5:31 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 2
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
Search our Forums:

Back to Top