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
 

 

Internal SORT in COBOL

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

New User


Joined: 09 Mar 2007
Posts: 7
Location: India

PostPosted: Fri Apr 20, 2007 3:09 am    Post subject: Internal SORT in COBOL
Reply with quote

Hi Friends,

I have a file contains many records. But I have some of the records in between other records.

Now, i want to SORT only required records - Say- if records contains 'DELETE' at some fixed position, then only these records should be sorted and written out into the output file. All other records should be written into the output file as it is without sorting.

Example: Input file

AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPICRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIDRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIXRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIBRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPILRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIGRWD

After Cobol Internal Sort, The output file should be as follows:

AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIBRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPICRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIDRWD
AAAAAA 12345 DELETE &BMEDPAC.KW894BC.KPIXRWD

AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIARWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPILRWD
AAAAAA 12345 STEPS &BMEDPAC.KW894BC.KPIGRWD

Could any one of you please help me with the COBOL coding.

Thank You.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 20, 2007 4:49 am    Post subject:
Reply with quote

Hello,

What should happen when, after the AAAAAA set of records, there is a BBBBBB set of records. Is your requirement that all of the A's stay together or should all of the DELETEs be put together.

Please expand your input/output to include at least one more "set" of records.

The good news is that to do what you want will not be difficult once the rules are understood icon_smile.gif
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Apr 20, 2007 5:06 am    Post subject:
Reply with quote

Other than the "BOLD"ing, is there a difference between the input file and the output file?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 20, 2007 5:30 am    Post subject:
Reply with quote

Yup, notice the sequence change in the DELETE records. . .
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Apr 20, 2007 5:35 am    Post subject:
Reply with quote

DANG! you must have the eyes of a young'n.... icon_wink.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Apr 20, 2007 5:38 am    Post subject:
Reply with quote

IEBIBALL to the rescue. . . .
Back to top
View user's profile Send private message
Harshavardhana

New User


Joined: 09 Mar 2007
Posts: 7
Location: India

PostPosted: Tue Apr 24, 2007 10:28 pm    Post subject: Re: Internal SORT in COBOL
Reply with quote

Hi dick scherrer,

Thank You for your response. In the example I have mentioned, there is no problem if I have another set of records as BBBBB.
Only I need is all steps that are having DELETE should be sorted for the datasets followed by DELETE. Rest of the records should be written to output file as it is without change.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Apr 24, 2007 10:50 pm    Post subject:
Reply with quote

Hello Harsh,

I don't believe i follow your most recent post. This
Quote:
I need is all steps that are having DELETE should be sorted for the datasets followed by DELETE
has me confused. . .

Please post your original input data and a set of BBBBBBs as a new input file and the desired output from the expanded input sample.
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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


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