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
 

 

SORT procedure in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: SORT procedure in COBOL
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    Post subject:
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    Post subject: Re: SORT procedure in COBOL
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: 3158
Location: Tucson AZ

PostPosted: Thu Jan 18, 2007 11:42 am    Post subject: Re: SORT procedure in COBOL
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    Post subject: Re: SORT procedure in COBOL
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    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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


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