Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping abend error

Status
Not open for further replies.
May 3, 2002
6
US
I'm getting an s322 abend error code for this program. I'm assuming it has something to do with either my array "SALES-NO-ARRAY" or search function since the original program is being modified (comments for 400 and 200 RTN may not be acurate due to modifications)to allow for each of the 25 salespeople to have an assigned salesperson number that can be any unique number between 001 and 999.


CBL FLAG(I,E),MAP
IDENTIFICATION DIVISION.
PROGRAM-ID. NWKLYSLS.
AUTHOR. JOE GOMEZ.
******************************************************************
* THIS PROGRAM USES THE CONTENTS OF WATTS-MY-LINE COMPANY'S *
* OLD WEEKLY SALES TRANSACTION FILE (OSLSTRAN) AS THE INPUT FOR *
* ITS REPORTS. THE PROGRAM THEN STORES THIS DATA IN A DOUBLE- *
* LEVEL ARRAY, SO THAT IT CAN BE USED TO PRODUCE A TWO-PART *
* COMPANY WEEKLY SALES REPORT. THE FIRST PORTION OF THE REPORT *
* PRINTS THE COMPANIES SALES (THE COMBINED SALES FOR THE 25 *
* SALESPERSONS) FOR EACH OF THE 7 DAYS OF THE WEEK AND PRINTS *
* THE COMPANIES WEEKLY TOTAL SALES. THE SECOND PORTION OF THE *
* REPORT PRINTS THE COMBINED WEEKLY SALES TOTALS FOR EACH OF *
* THE 25 SALESPERSONS. BOTH PORTIONS OF THE REPORT ARE DOUBLE- *
* SPACED. THIS REPORT IS NEEDED SO THAT MANAGERS WILL HAVE *
* ACCESS TO ACCURATE AND TIMELY SALES INFORMATION. *
******************************************************************
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT SALES-FILE ASSIGN TO NSLSTRAN.
SELECT SORT-FILE ASSIGN TO SYSWORK.
SELECT SORTED-FILE ASSIGN TO NEW-MASTER.
SELECT PRINT-FILE ASSIGN TO PRINTER.
*
DATA DIVISION.
FILE SECTION.
FD SALES-FILE
RECORDING MODE IS F
RECORD CONTAINS 80 CHARACTERS.
01 SALES-RECORD.
05 SLS-REC PIC X(20).
SD SORT-FILE.
01 SORT-REC.
05 PIC XX.
05 S-SLS-NBR PIC X(3).
05 PIC X(75).
FD SORTED-FILE
RECORDING MODE IS F
RECORD CONTAINS 80 CHARACTERS.
01 OUT-REC.
05 SSF-SLS-DAY PIC 99.
05 SSF-SLS-NBR PIC X(3).
05 SSF-SLS-AMT PIC 9(4)V99.
05 PIC X(69).
FD PRINT-FILE
RECORDING MODE IS F
RECORD CONTAINS 80 CHARACTERS.
01 PRINT-REC PIC X(80).
*
WORKING-STORAGE SECTION.
01 WS-WORK-AREAS.
05 ARE-THERE-MORE-RECORDS PIC X VALUE 'Y'.
88 MORE-RECORDS VALUE 'Y'.
88 NO-MORE-RECORDS VALUE 'N'.
05 WS-PAGE PIC 99 VALUE ZERO.
05 WS-DATE.
10 WS-YEAR PIC 99.
10 WS-MONTH PIC 99.
10 WS-DAY PIC 99.
05 WS-TOT-SALES PIC 9(7)V99 VALUE ZERO.
05 WS-CMPY-SALES PIC 9(7)V99 VALUE ZERO.
05 SUB1 PIC 99 VALUE ZERO.
05 SUB2 PIC 99 VALUE ZERO.
01 SALES-ARRAY.
05 SLS-LEVEL OCCURS 25 TIMES.
10 SALES-AMT OCCURS 7 TIMES
PIC 9(7)V99 VALUE ZEROS.
01 SALES-NO-ARRAY.
05 SLSPRSNS-NBR OCCURS 25 TIMES INDEXED BY X1
PIC X(3) VALUE SPACES.
01 DAY-NAME-TABLE.
05 STRING-2 PIC X(21) VALUE
'MONTUEWEDTHUFRISATSUN'.
05 DAY-NAME REDEFINES STRING-2
OCCURS 7 TIMES PIC XXX.
01 HEADING-1.
05 PIC X VALUE SPACES.
05 HL-DATE.
10 HL-MONTH PIC 99.
10 PIC X VALUE '/'.
10 HL-DAY PIC 99.
10 PIC X VALUE '/'.
10 HL-YEAR PIC 99.
05 PIC X(9) VALUE SPACES.
05 PIC X(45) VALUE
'WEEKLY SALES REPORT FOR WATTS-MY-LINE COMPANY'.
05 PIC X(9) VALUE SPACES.
05 PIC X(5) VALUE 'PAGE '.
05 HL-PAGE-NO PIC Z9.
05 PIC X VALUE SPACES.
01 HEADING-2.
05 PIC X(33) VALUE SPACES.
05 PIC X(47) VALUE
'COMPANY TOTALS'.
01 HEADING-3.
05 PIC X(27) VALUE SPACES.
05 PIC X(14) VALUE 'DAY'.
05 PIC X(39) VALUE
'DAILY SALES'.
01 HEADING-4.
05 PIC X(31) VALUE SPACES.
05 PIC X(49) VALUE
'SALESPERSON TOTALS'.
01 HEADING-5.
05 PIC X(21) VALUE SPACES.
05 PIC X(20) VALUE
'SALESPERSON NBR'.
05 PIC X(39) VALUE
'WEEKLY SALES'.
01 DETAIL-LINE.
05 PIC X(27) VALUE SPACES.
05 DAY-OUT PIC XXX.
05 SLS-NO-OUT REDEFINES DAY-OUT PIC XXX.
05 PIC X(10) VALUE SPACES.
05 TOTAL-OUT PIC $Z,ZZZ,ZZ9.99.
05 PIC X(27) VALUE SPACES.
01 FOOTER-LINE.
05 PIC X(40) VALUE SPACES.
05 PIC X(13) VALUE ALL '-'.
05 PIC X(27) VALUE SPACES.
01 TOTAL-LINE.
05 PIC X(27) VALUE SPACES.
05 PIC X(13) VALUE 'WEEK'.
05 CMPY-TOTAL-OUT PIC $Z,ZZZ,ZZ9.99.
05 PIC X(27) VALUE SPACES.
PROCEDURE DIVISION.
******************************************************************
* THE MAIN-MODULE DIRECTS AND CONTROLS ALL PROCESSING DONE BY *
* THE PROGRAM. IT EXECUTE PROGRAM INITIALIZATION, AND THEN *
* REPEATEDLY EXECUTES THE ACCUMULATED-DATA RTN UNTIL EOF. *
* NEXT, IT EXECUTES THE FIRST WRITE RTN (WHICH EXTRACTS AND *
* WRITES DATA FROM THE SALES TABLE IN THE COMPANY DAILY-SALES *
* REPORT FORMAT). THEN THE PAGE COUNTER IS RESET AND THE *
* INITIAL HEADING FOR THE SECOND PORTION OF THE REPORT IS *
* WRITTEN. NEXT, IT EXECUTES THE SECOND WRITE RTN (WHICH *
* RE-EXTRACTS THE DATA FROM THE SALES TABLE, THIS TIME IT IS *
* SUMMARIZED IN SALES BY SALESPERSON FORMAT). FINALLY IT CALLS *
* THE CLOSING RTN AND TERMINATES THE PROGRAM. *
******************************************************************
100-MAIN-MODULE.
PERFORM 200-INITIALIZATION-RTN.
PERFORM 400-ACCUMULATE-DATA-RTN
UNTIL NO-MORE-RECORDS.
PERFORM 500-WRITE-1-RTN
VARYING SUB2 FROM 1 BY 1
UNTIL SUB2 > 7.
PERFORM 800-RESET-RTN.
PERFORM 600-WRITE-2-RTN
VARYING SUB1 FROM 1 BY 1
UNTIL SUB1 > 25.
PERFORM 1100-CLOSING-RTN.
STOP RUN.
******************************************************************
* THE INITIALIZATION-RTN DIRECTS THE PROGRAMS PREPROCESSIG *
* INITIALIZATION. IT BEGINS BY OPENING THE FILES AND ACCEPTING *
* THE DATE FROM THE COMPUTERS O/S. IT STORES THE DATE IN THE *
* FIRST HEADING LINE. NEXT, THE HEADER RTN FOR THE FIRST PART *
* OF THE REPORT IS WRITTEN. FINALLY THE PRIMING READ OF THE *
* SALES TRANSACTION FILE IS PERFORMED. *
******************************************************************
200-INITIALIZATION-RTN.
SORT SORT-FILE
ON ASCENDING KEY S-SLS-NBR
USING SALES-FILE
GIVING SORTED-FILE
OPEN INPUT SORTED-FILE
OUTPUT PRINT-FILE.
ACCEPT WS-DATE FROM DATE.
MOVE WS-MONTH TO HL-MONTH.
MOVE WS-DAY TO HL-DAY.
MOVE WS-YEAR TO HL-YEAR.
PERFORM 300-READ-SALES-RTN.
PERFORM 900-HEADING-1-RTN.
******************************************************************
* THE READ-SALES-RTN READS RECORDS FROM THE COMPANIES SALES *
* TRANSACTION FILE. AT EOF, IT MOVES 'NO ' TO ARE-THERE-MORE- *
* RECORDS. *
******************************************************************
300-READ-SALES-RTN.
READ SORTED-FILE
AT END
SET NO-MORE-RECORDS TO TRUE
END-READ.
******************************************************************
* THE ACCUMULATE-DATA-RTN ADDS THE INPUT SALES TRANSACTION *
* AMOUNTS TO THE APPROPRIATE ARRAY ELEMENTS (BY SALESPERSON NBR *
* AND DAY-OF-WEEK). AFTER EACH SUCH ACCUMULATION, IT EXECUTES *
* A READ OF THE NEXT SALES TRANSACTION RECORD. *
******************************************************************
400-ACCUMULATE-DATA-RTN.
SET X1 TO 1.
SEARCH SLSPRSNS-NBR VARYING X1
AT END
DISPLAY 'MORE THAN 25 SALESPERSONS'
WHEN SLSPRSNS-NBR (X1) = SSF-SLS-NBR
SET SUB1 TO X1
ADD SSF-SLS-AMT TO SALES-AMT (SUB1, SSF-SLS-DAY)
WHEN SLSPRSNS-NBR (X1) = SPACES
SET SUB1 TO X1
MOVE SSF-SLS-NBR TO SLSPRSNS-NBR (X1)
ADD SSF-SLS-AMT TO SALES-AMT (SUB1, SSF-SLS-DAY)
PERFORM 300-READ-SALES-RTN.
******************************************************************
* THE WRITE-1-RTN INITIALIZES THE SALES AMOUNT ACCUMULATOR AND *
* STORES THE CORRECT DAY-OF-THE-WEEK IN THE DETAIL-LINE. IT *
* THEN ACCUMULATES AND WRITES COMPANY SALES AMOUNTS FOR THE *
* CORRECT DAY-OF-THE-WEEK. FINALLY, IT ACCUMULATES THE TOTAL *
* WEEKLY SALES FOR THE COMPANY. *
******************************************************************
500-WRITE-1-RTN.
MOVE ZERO TO WS-TOT-SALES.
MOVE DAY-NAME (SUB2) TO DAY-OUT.
PERFORM 700-ADD-RTN
VARYING SUB1 FROM 1 BY 1
UNTIL SUB1 > 25.
MOVE WS-TOT-SALES TO TOTAL-OUT.
WRITE PRINT-REC FROM DETAIL-LINE
AFTER ADVANCING 2 LINES.
ADD WS-TOT-SALES TO WS-CMPY-SALES.
******************************************************************
* THE WRITE-2-RTN INITIALIZES THE SALES AMOUNT ACCUMULATOR AND *
* STORES THE CORRECT SALES PERSON NUMBER IN THE DETAIL-LINE. *
* IT THEN ACCUMULATES AND WRITES WEEKLY SALES AMOUNTS FOR THE *
* CORRECT SALESPERSON NUMBER. *
******************************************************************
600-WRITE-2-RTN.
MOVE ZERO TO WS-TOT-SALES.
MOVE SUB1 TO SLS-NO-OUT.
PERFORM 700-ADD-RTN
VARYING SUB2 FROM 1 BY 1
UNTIL SUB2 > 7.
IF WS-TOT-SALES NOT = ZERO
MOVE WS-TOT-SALES TO TOTAL-OUT.
WRITE PRINT-REC FROM DETAIL-LINE
AFTER ADVANCING 2 LINES.
******************************************************************
* THE ADD-RTN ADDS SELECTED (BY SUBSCRIPT) INDIVIDUAL SALES *
* AMOUNTS IN THE SALES ARRAY TO THE REPORT SALES ACCUMULATOR. *
******************************************************************
700-ADD-RTN.
ADD SALES-AMT (SUB1, SUB2) TO WS-TOT-SALES.
******************************************************************
* THE RESET-RTN STORES THE TOTAL WEEKLY COMPANY SALES IN THE *
* TOTAL LINE. THEN IT PRINTS THE FOOTER AND TOTAL LINES, AND *
* EXECUTES THE HEADING-2-RTN. *
******************************************************************
800-RESET-RTN.
MOVE WS-CMPY-SALES TO CMPY-TOTAL-OUT.
WRITE PRINT-REC FROM FOOTER-LINE
AFTER ADVANCING 2 LINES.
WRITE PRINT-REC FROM TOTAL-LINE
AFTER ADVANCING 2 LINES.
PERFORM 1000-HEADING-2-RTN.
******************************************************************
* THE HEADING-1-RTN INCREMENTS THE PAGE COUNTER AND STORES IT *
* IN THE FIRST HEADING LINE. THEN IT ADVANCES TO A NEW PAGE *
* AND PRINTS THE HEADING LINES FOR THE FIRST PORTION OF THE *
* REPORT (WHICH LISTS THE COMPANIES DAILY TOTAL SALES FOR THE *
* WEEK). *
******************************************************************
900-HEADING-1-RTN.
ADD 1 TO WS-PAGE.
MOVE WS-PAGE TO HL-PAGE-NO.
WRITE PRINT-REC FROM HEADING-1
AFTER ADVANCING PAGE.
WRITE PRINT-REC FROM HEADING-2
AFTER ADVANCING 2 LINES.
WRITE PRINT-REC FROM HEADING-3
AFTER ADVANCING 2 LINES.
******************************************************************
* THE HEADING-2-RTN INCREMENTS THE PAGE COUNTER AND STORES IT *
* IN THE FIRST HEADING LINE. THEN IT ADVANCES TO A NEW PAGE *
* AND PRINTS THE HEADING LINES FOR THE SECOND PORTION OF THE *
* REPORT (WHICH LISTS WEEKLY SALES TOTALS FOR EACH OF THE *
* COMPANIES SALESPERSONS). *
******************************************************************
1000-HEADING-2-RTN.
ADD 1 TO WS-PAGE.
MOVE WS-PAGE TO HL-PAGE-NO.
WRITE PRINT-REC FROM HEADING-1
AFTER ADVANCING PAGE.
WRITE PRINT-REC FROM HEADING-4
AFTER ADVANCING 2 LINES.
WRITE PRINT-REC FROM HEADING-5
AFTER ADVANCING 2 LINES.
******************************************************************
* THE CLOSING-RTN CLOSES BOTH INPUT AND OUTPUT FILES. *
******************************************************************
1100-CLOSING-RTN.
CLOSE SORTED-FILE
PRINT-FILE.
 
For those who don't use mainframes: s322 description "job or step time exceeded the specified limit. Program is in a loop. Insufficient time parameter on job or exec card"
 
I figured out my problem, I didn't have my second array set up parallel, so my search wasn't working right.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top