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
 

 

Cobol Internal sort

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
vaibhavkolhe

New User


Joined: 24 Feb 2005
Posts: 11

PostPosted: Wed Mar 18, 2009 10:12 pm    Post subject: Cobol Internal sort
Reply with quote

Hello,

I need to perform an internal sort in a cobol program and I will be using Input Procedure & Output Procedure to do it. The following is the description of the Input file

FD INFILE
01 INREC.
05 IN-REC-TYPE PIC X(3)
05 IN-PA-CODE PIC x(2)
05 IN-PROD-TYPE PIC X(1)
05 IN-AGT-NAME PIC X(20).
......

FD OUTFILE
01 OUTREC.
05 OUT-REC-TYPE PIC X(3)
05 OUT-PA-CODE PIC x(2).
05 OUT-PROD-TYPE PIC X(1).
05 OUT-AGT-NAME PIC X(20).

I need to sort the INFILE on IN-PA-CODE, IN-PROD-TYPE and IN-AGT-NAME in that order. However, I need to have a different value in the SORT-PROD-TYPE field which will be hard coded in the Input procedure. After sorting, and releasing the record, I need to write a report based on OUT-PROD-TYPE.

Question:
1. What would be the definition of the SORT-REC?
2. If the SORT field is a part of the data record, does it affect the output records?
3. Can anybody list the algorithm of how this can be done?

Thanks,
Vaibhav
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7935
Location: Bellevue, IA

PostPosted: Wed Mar 18, 2009 10:51 pm    Post subject:
Reply with quote

Quote:
I will be using Input Procedure & Output Procedure to do it.
conflicts with
Quote:
I need to sort the INFILE
Either you are using INPUT PROCEDURE and OUTPUT PROCEDURE, or you are using a file sort -- you can't have it both ways unless you're doing two sorts.

Define your SORT RECORD with the fields you want to sort -- and the SORT RECORD does not have to match your input file layout, your output file layout, or anything else. Code up your INPUT PROCEDURE and OUTPUT PROCEDURE statements to do the processing you want. Compile, bind, and run.
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: Thu Mar 19, 2009 12:04 am    Post subject:
Reply with quote

Hello,

If you post your SD and your SORT statement, someone will be able to confirm if you are moving in the right direction. . .
Back to top
View user's profile Send private message
arunmozhicholan

New User


Joined: 07 Feb 2007
Posts: 27
Location: chennai

PostPosted: Mon Mar 23, 2009 6:29 pm    Post subject:
Reply with quote

Hi ,

1)What would be the definition of the SORT-REC?

you need to define on wat condition going to sort that needs to be in
SD entry
2. If the SORT field is a part of the data record, does it affect the output records?
YES

3. Can anybody list the algorithm of how this can be done?

Release sort-rec asc/dec keys
using input procedure file 1 file 2
output procedure file 3

while reading the file u need to move the values to sort record which u have in sd entry and relaese
and open the input file
Return in the ouput procedure
from sort record
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    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
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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