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

SORT procedure in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Thu Jan 18, 2007 10:29 am
Reply with quote

Hi,

I have a 2 cobol programs say A and B and A calls B.

"A" has the SORT input and output procedures. "B" is called from "A"
both in input and output procedures. "B" prints a file.

We have to convert COBOL program to COBOL/370 program.
Both the versions execute sucessfully but the output files are not the
same.

when We put Display statement while executing COBOL/370 version,
we found the print record display pattern in the sysout does not match output file's records order.

In the output file a record is repeated at the end many times.
we find no repetition in the sysout.
The cobol version output file did not have the record repetition.

hope i explained reasonably... what could be the reason.
Any sugesstions

the sort statement in "A".
SORT SORTFILE
ASCENDING AS-COMPANY-CODE, SORT-WORK-KEY, AS-OFFICE-NO
INPUT PROCEDURE ACCTS-REC-BRANCH-REPORT
OUTPUT PROCEDURE ACCTS-REC-SUMMARY-REPORT


Regards,
Sasi Patha.
Back to top
View user's profile Send private message
tangentray

New User


Joined: 30 Dec 2006
Posts: 20
Location: Kolkata, India

PostPosted: Thu Jan 18, 2007 10:46 am
Reply with quote

It will be mere speculation rather than conclusion to comment anything at this point without looking in greater detail.
I cannot understand how it is possible that the order in which you are getting the displays vary from the order in which you are getting in the ouput file provided you have given the displays in your output procedure after the RELEASE statement.
If the order is not same in the 2 versions that you have, that might be because the keys are beaing read differently in the 2 versions. I will suggest you display the keys to find out that they are being read rightly.
The problem of repetation of last rcord is normally due to erroneous looping. But in this case assuming that you have no looping since you are directly writing in the output procedue, it might happen due to erroneous sorting as well. I will suggest that make sure that the keys are same and correct.
Back to top
View user's profile Send private message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Thu Jan 18, 2007 11:22 am
Reply with quote

Hi,
Thanq. I understand granular details are needed :-).
Its 1st time i come accross sort procedure in our shop.

The DISPLAY order varies with output file record order even with
COBOL version.
The only changes we made to convert the program into COBOL/370
is changing positioning verb to advancing verb in Program "B".
We did not make any changes to loops or sort. The RELEASE
statement is in progrma A and the file is printed in program B.
We put diaplay statement just before writing the file.

One record is repeated at the end of the report in the output file
for COBOL/370 version execution, this repetition is not in corresponding SYSOUT. Hence i ruled out chances of an erraneous loop.

How do i check if SORT is behaving differently in COBOL/370 version.
The SYSOUT of COBOL and COBOL/370 are same.

The sort work key is combination of:
ACCT-SUM-REGION PIC X.
ACCT-SUM-DIVISION PIC X.
ACCT-SUM-AREA PIC X.
ACCT-SUM-DIST PIC X.

One more observation which might be helpful to us is:
The print-rec is not initialized after the write advancing,
its source print-line is initialized.
There can be a case when the write para is performed
without any write statement executed, i.e print-rec is populated from print-line and printed only if conditions are met.

Regards,
Sasi Patha.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


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

PostPosted: Thu Jan 18, 2007 11:42 am
Reply with quote

Sasi Kiran Patha wrote:
The only changes we made to convert the program into COBOL/370 is changing positioning verb to advancing verb in Program "B".
Your problem is there, but I haven't found a manual old enough to remind me of the rules for positioning vs advancing....
Back to top
View user's profile Send private message
Sasi Kiran Patha
Warnings : 2

New User


Joined: 19 Nov 2006
Posts: 73
Location: Hyederabad

PostPosted: Thu Jan 18, 2007 1:58 pm
Reply with quote

Hi thank u all for timely replies.

The issue was solved.. It was a coding mistake, unfortunately output files'
data tempted us to think differently.
The writing of print-rec for file in one of the conditions in program B should have been print-rec9 of another file in the program B. Corrected
print-rec to print-rec9.

Sorry.

regards,
Sasi Patha.
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 2
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top