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

COB2 file processing


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rizwanaccy

New User


Joined: 02 Jan 2018
Posts: 11
Location: INDIA

PostPosted: Tue Jan 02, 2018 1:00 pm
Reply with quote

Hi,

I need help on processing of SORTIN file in COB2 module. SORTIN and SORTOUT files are defined at linkage section. I can see in the code FIRST-RECORD,OTHER-RECORD and END-RECORD are defined.

I am not clear how each record is getting read? and how FIRST-RECORD,OTHER-RECORD and END-RECORD are set ?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jan 02, 2018 3:33 pm
Reply with quote

I think your program is a Sort Exit, maybe E15

The program gets control with each record from the SORTIN, and returns a Return Code that tells Sort to accept the record, delete it or modify it.
There are other options (insert a new record, end the sort...)

You should check you SYNCSORT/DFSORT documentation.
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jan 02, 2018 4:16 pm
Reply with quote

FIRST-RECORD, OTHER-RECORD and END-RECORD are set by the sort program and allow you to do extra processing, like opening (at FIRST) and closing (at LAST) a secondary file.
Back to top
View user's profile Send private message
rizwanaccy

New User


Joined: 02 Jan 2018
Posts: 11
Location: INDIA

PostPosted: Tue Jan 02, 2018 6:56 pm
Reply with quote

When I am executing the program it goes directly to END-RECORD. What could be the cause?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Tue Jan 02, 2018 8:13 pm
Reply with quote

Did you execute your sort program ?
Code:
//STEP01   EXEC PGM=SORT
//SORTIN   DD   DISP=SHR,DSN=hlq.input
//SORTOUT  DD   DISP=SHR,DSN=hlq.output
//SYSIN    DD   *
   SORT FIELDS=COPY
   MODS E15=(YourProgramName,EstimatedPgmSize,,C)
//*

What I would do before running the program:
1. Search all JCL libraries for a job having "YourProgramName" in it.
2. Check the source code to see if there is any information about the input dataset (in working-storage and linkage, in copybooks and in comments for example).
Back to top
View user's profile Send private message
rizwanaccy

New User


Joined: 02 Jan 2018
Posts: 11
Location: INDIA

PostPosted: Wed Jan 03, 2018 5:39 pm
Reply with quote

Hi Marso,

Thank you icon_biggrin.gif , with E15 it worked but it was E35 before. Why it did not worked with E35?

My JCL was like this.
//SORTIN DD DSN=XXX.YYY,DISP=OLD
//SORTOUT DD DSN=AAA.YYY,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COBEXIT=COB2
INCLUDE COND=(35,2,CH,EQ,C'01',OR,35,2,CH,EQ,C'03'),FORMAT=CH
SORT FIELDS=(1,6,CH,A,19,16,CH,A,7,12,CH,A,35,5,CH,A,
46,4,CH,D,43,2,CH,D)
RECORD TYPE=F,LENGTH=(206,,270)
MODS E35=(module_name,200000,,C)
Back to top
View user's profile Send private message
rizwanaccy

New User


Joined: 02 Jan 2018
Posts: 11
Location: INDIA

PostPosted: Wed Jan 03, 2018 6:51 pm
Reply with quote

Hi,

It still did not work with E15, for first record , sort-flag is 0 , for second record sort-flag is 4 , from 3rd record onwards sort-flag value is 655360.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Jan 03, 2018 7:10 pm
Reply with quote

How about showing some useful output from your job ?
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 Jan 03, 2018 7:26 pm
Reply with quote

Do you understand the difference between an E15 and an E35 exit? If not, you need to read the manuals more.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
Search our Forums:

Back to Top