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

Internal SORT in COBOL


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

Moderator Emeritus


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

PostPosted: Fri Apr 20, 2007 4:49 am
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: 3156
Location: Tucson AZ

PostPosted: Fri Apr 20, 2007 5:06 am
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

Moderator Emeritus


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

PostPosted: Fri Apr 20, 2007 5:30 am
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: 3156
Location: Tucson AZ

PostPosted: Fri Apr 20, 2007 5:35 am
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

Moderator Emeritus


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

PostPosted: Fri Apr 20, 2007 5:38 am
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
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

Moderator Emeritus


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

PostPosted: Tue Apr 24, 2007 10:50 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top