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

Performs until subscript Value reaches 10


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

New User


Joined: 05 Oct 2010
Posts: 9
Location: Chandigarh

PostPosted: Tue Mar 25, 2014 5:12 pm
Reply with quote

Hi I have one issue. There is an existing logic which performs until subscript it value reaches 10. This loops for 10 records and perfoms some para. After performing for 10 records it then comes out of loop and then writes the record. PFB the code
Code:

IF IN1-KEY = IN2-KEY                                 
   PERFORM UNTIL WS-SUB > 10                         
     OR IN1-KEY NOT = IN2-KEY                       
     PERFORM 4100-MATCH THRU 4100-EXIT               
     PERFORM 3000-READ-IN2 THRU 3000-EXIT           
   END-PERFORM                                       
   WRITE OUT-RECORD FROM PRC-EXT-REC                 
   ADD 1 TO OUT-CTR                                 
   MOVE 'Y' TO WS-BRKPT-SW                           
ELSE                                                 
   IF IN1-KEY < IN2-KEY                             
      IF WS-BRKPT-SW = SPACES                       
         MOVE PRC-EXT-AMT-POP                       
                            TO PRC-EXT-ASK-PRICE(1) 
         WRITE OUT-RECORD FROM PRC-EXT-REC           
         ADD 1 TO OUT-CTR                           
      ELSE                                           
         MOVE SPACES TO WS-BRKPT-SW                 
      END-IF     


there was one abend in Job where we had 13 records for key value and it abended with s013 code.
Now they then removed all 13 reocrds and program ran fine.
now it is required that of we have more than 10 records for that key it should abend and if it is less than 10 it shold follow the current logic.
Need to have the code change. Need help on this
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Mar 25, 2014 6:09 pm
Reply with quote

If what you say is accurate, you just have to abend after your loop if WS-SUB is greater than 10.

This assumes that WS-SUB is incremented in 3000-READ-IN2 or that if incremented in 4100-MATCH it reflects the number of records.

However, you're going to have to check on that. You need something which counts records per key. If you have that already, OK, if not you need to include code for it.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Mar 25, 2014 6:14 pm
Reply with quote

Is the ultimate need to abend if the key has 13 records or to process only those key which has 10 records?
Back to top
View user's profile Send private message
rupeshgullu

New User


Joined: 05 Oct 2010
Posts: 9
Location: Chandigarh

PostPosted: Tue Mar 25, 2014 6:47 pm
Reply with quote

Requirement is to abend the program if it has more than 10 records.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Mar 26, 2014 7:43 am
Reply with quote

You need to show complete logic..

What logic is in place inside ,

Code:
PERFORM 4100-MATCH THRU 4100-EXIT               
     PERFORM 3000-READ-IN2 THRU 3000-EXIT   


How and where WS-SUB getting incremented and what is the declaration?

Why do you think S013 abend belongs to the mentioned code by you?

And even if you get more than 10 records for same key ( or why it failed when it was 13 only?), you are expecting to abend the program, why? and then will you be deleting them back again and restarting it?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Mar 26, 2014 8:54 am
Reply with quote

Add a sort step before this find the count of keys and if you find records with more than 10 for a key dont processs the program
Back to top
View user's profile Send private message
rupeshgullu

New User


Joined: 05 Oct 2010
Posts: 9
Location: Chandigarh

PostPosted: Wed Mar 26, 2014 10:54 am
Reply with quote

Hi,

WS-SUB is initiallized at read only. This program is going in for infinite loop when I ran it in Dev region and as per the client it should not process for more than 8 records. anything beyond 8 records are considered as duplicates.

in 4100-match-process para we just move the data to output variables based upon some condition and then read the second file

I have also given the same sugestion to reomove the ducplkciates using sort. so lets see what they reply
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Mar 26, 2014 11:01 am
Reply with quote

Whatever you have described is very complicated and different than initial question.

however, why only today this job has a abend and not before? Does input file is not correct as it supposed to be ?
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Mar 26, 2014 2:40 pm
Reply with quote

There seems to be an architecture issue here - whatever is creating the dataset that you are reading is wrong and IT should be changed. If it is not wrong then the client is wrong by saying that there should be no more than 8 records.

An S013 would indicate that there is a problem reading a PDS but as you did not specify the reason code and we have no idea about the input file formats no one can really say. There seems to be confusion all over the place.
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: Wed Mar 26, 2014 7:06 pm
Reply with quote

Hello,

Which of the possible s013 abends was raised? Along with this, there should be a message with more info ablout the abend . . .
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Mar 26, 2014 7:35 pm
Reply with quote

Is the file a VSAM ESDS or KSDS?

A small Assembler sub-program would return the number of records on a given VSAM file, via a SHOWCB Macro.
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 Finding faulty logic Subscript out of... COBOL Programming 5
No new posts Confusion b/w index and subscript Mainframe Interview Questions 7
No new posts Subscript vs Index COBOL Programming 4
No new posts Index and subscript in Arrays COBOL Programming 9
No new posts Use subscript for index array??? COBOL Programming 7
Search our Forums:

Back to Top