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

Cobol Internal sort


IBM Mainframe Forums -> COBOL Programming
Post new topic   This topic is locked: you cannot edit posts or make replies.
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 18, 2009 10:51 pm
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

Moderator Emeritus


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

PostPosted: Thu Mar 19, 2009 12:04 am
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
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. 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