MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to find end of instream data

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
butta_mvs
Beginner


Joined: 17 Aug 2003
Posts: 22
Topics: 18

PostPosted: Thu Dec 11, 2003 9:02 am    Post subject: how to find end of instream data Reply with quote

I am passing data to cobol pgm from jcl thru SYSIN .In my cobol iam receiving the data thru accept statements , but iwant to know how to find out the end of instrean data.

BUTTA
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Thu Dec 11, 2003 9:36 am    Post subject: Reply with quote

Butta_mvs,
You can read SYSIN like a normal file and the end-of-file will automatically happen at end(when encountered by /*), you also have many choices like
//SYSIN DD DATA
aaa
bbb
/*
OR
//SYSIN DD *,DLM=XX -- This is a delimiter
aaa
bbb
XX

You may prefer to READ rather than ACCEPT. Thanks
Back to top
View user's profile Send private message
Sreejith
Intermediate


Joined: 02 Dec 2002
Posts: 155
Topics: 25
Location: N.Ireland

PostPosted: Thu Dec 11, 2003 10:47 am    Post subject: Reply with quote

Some thing like this

MOVE HIGH-VALUES TO IN-DATA
ACCEPT IN-DATA FROM SYSIN
IF IN-DATA = HIGH-VALUES
NO MORE RECORDS
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
gans79
Beginner


Joined: 31 Aug 2005
Posts: 51
Topics: 27

PostPosted: Mon Aug 21, 2006 7:09 am    Post subject: Reply with quote

Hi,
How can we read instream data using READ & AT END, can someone give me an example It gives a error "VAR defined as a type that was invalid in this context"
do we need to add a linkage section in this case ?
help with example will be greatly appreciated

Thanks
ganesh
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Mon Aug 21, 2006 7:33 am    Post subject: Reply with quote

Program:
Code:

       IDENTIFICATION DIVISION.                                         
                                                                       
       ENVIRONMENT DIVISION.                                           
       INPUT-OUTPUT SECTION.                                           
                                                                       
         FILE-CONTROL.                                                 
           SELECT INPUT-FILE ASSIGN TO UT-S-SYSUT1                     
             ORGANIZATION IS SEQUENTIAL                                 
             ACCESS IS SEQUENTIAL.                                     
                                                                       
       DATA DIVISION.                                                   
       FILE SECTION.                                                   
                                                                       
       FD  INPUT-FILE                                                   
           LABEL RECORD STANDARD                                       
           BLOCK 0 RECORDS                                             
           RECORDING MODE F                                             
           RECORD CONTAINS 80 CHARACTERS.                               
                                                                       
       01 INPUT-RECORD                 PIC X(80).                       
                                                                       
       WORKING-STORAGE SECTION.                                   
                                                                 
       PROCEDURE DIVISION.                                       
           OPEN INPUT INPUT-FILE.                                 
           PERFORM P000-READ-AND-WRITE THRU P000-EXIT.           
           CLOSE INPUT-FILE.                                     
           MOVE ZEROS TO RETURN-CODE.                             
           STOP RUN.                                             
                                                                 
       P000-READ-AND-WRITE                                       
           READ INPUT-FILE                                       
             AT END GO TO P000-EXIT.                             
           DISPLAY INPUT-RECORD.                                 
           GO TO P000-READ-AND-WRITE.                             
       P000-EXIT.                                                 
           EXIT.                                                 


JCL:
Code:

//STEP0001 EXEC PGM=PROGXX     
//SYSUT1   DD   *                                         
TEST RECORD 01 OF 10.                                     
TEST RECORD 02 OF 10.                                     
TEST RECORD 03 OF 10.                                     
TEST RECORD 04 OF 10.                                     
TEST RECORD 05 OF 10.                                     
TEST RECORD 06 OF 10.                                     
TEST RECORD 07 OF 10.                                     
TEST RECORD 08 OF 10.                                     
TEST RECORD 09 OF 10.                                     
TEST RECORD 10 OF 10.                                     
/*                                                       
//SYSOUT   DD   SYSOUT=*                                 
//*                                                       


Output:
Code:

SUPERK JOB   12607  DDname - SYSOUT    Stepname - STEP0001  Procstep -       
-------------------------------------------------------------------------------
...+....10...+....20.|.+....30...+....40...+....50...+....60...+....70...+....
TEST RECORD 01 OF 10.                                                         
TEST RECORD 02 OF 10.                                                         
TEST RECORD 03 OF 10.                                                         
TEST RECORD 04 OF 10.                                                         
TEST RECORD 05 OF 10.                                                         
TEST RECORD 06 OF 10.                                                         
TEST RECORD 07 OF 10.                                                         
TEST RECORD 08 OF 10.                                                         
TEST RECORD 09 OF 10.                                                         
TEST RECORD 10 OF 10.                                                         
********************************** End of Data ********************************
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 21, 2006 8:35 am    Post subject: Reply with quote

superk,

I am getting a Run time Error ABENDED S001 U0000.When i tried debuging , the program flow is ok till before the Para PERFORM 110-READ-INPUT-FILE THRU 110-READ-INPUT-FILE-EXIT. and after that when it executes the statement it is failing and i guess it is not able to read the file.Can you please help me:
Code:

       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT INPUT-FILE   ASSIGN TO SYSUT1
                  FILE STATUS IS INPUT-FILE-STATUS.

       DATA DIVISION.
       FILE SECTION.
       FD  INPUT-FILE
           RECORDING MODE IS F
           DATA RECORD IS INPUT-REC.

       01 INPUT-REC         PIC 9(02).

       WORKING-STORAGE SECTION.
       01 WS-VARIABLES.
          05 WS-INPUT            PIC 9(02)  VALUE 0.
          05 WS-SUM              PIC 9(02)  VALUE 0.

       01  WS-FLAGS.
           05 INPUT-EOF-SWITCH            PIC X(01) VALUE SPACE.
              88 INPUT-NOT-EOF            VALUE 'Y'.
              88 INPUT-EOF                VALUE 'N'.

       01  WS-FILE-STATS.
           05  INPUT-FILE-STATUS             PIC  X(02) VALUE ZERO.
               88 INPUT-FILE-IO-OKAY         VALUE '00'.
               88 INPUT-FILE-END             VALUE '10'.

       01  WS-LITERALS.
           05 ABEND-MSG                PIC X(80).
           05 ABEND-STATUS             PIC X(02).

       PROCEDURE DIVISION.
       000-MAINLINE.

           PERFORM 100-STARTUP      THRU 100-STARTUP-EXIT.
           PERFORM 200-PROCESS-DATA THRU 200-PROCESS-DATA-EXIT.
           PERFORM 300-FINISH       THRU 300-FINISH-EXIT.

       100-STARTUP.
      D    DISPLAY '100-STARTUP'.

           OPEN INPUT INPUT-FILE.
           EVALUATE INPUT-FILE-STATUS
              WHEN '00'
                   CONTINUE
              WHEN OTHER
                   DISPLAY '*********** ERROR *******************'
                   MOVE '100:OPEN FAILED FOR INPUT-FILE' TO ABEND-MSG
                   MOVE INPUT-FILE-STATUS               TO ABEND-STATUS
                   DISPLAY "*********** ERROR *******************"
                   PERFORM 999-ABEND-ERROR THRU 999-ABEND-ERROR-EXIT
           END-EVALUATE.

      D    DISPLAY '100-STARTUP-EXIT'.
       100-STARTUP-EXIT.
           EXIT.

       110-READ-INPUT-FILE.
      ******************************************************************
      * THIS PROCEDURE                                                 *
      * CALLS:                                                         *
      * CALLED BY:  200-PROCESS-DATA                                   *
      ******************************************************************
      D    DISPLAY '110-READ-INPUT-FILE'.

           INITIALIZE INPUT-REC.
           READ INPUT-FILE
           AT END
                SET INPUT-EOF  TO TRUE
           NOT AT END
                IF INPUT-FILE-STATUS IS EQUAL TO '00'
                   CONTINUE
                ELSE
                   MOVE '110:READ FAILED FOR INPUT FILE' TO ABEND-MSG
                   MOVE INPUT-FILE-STATUS   TO ABEND-STATUS
                   PERFORM 999-ABEND-ERROR  THRU 999-ABEND-ERROR-EXIT
                END-IF
           END-READ.

      D    DISPLAY '110-READ-INPUT-FILE-EXIT'.
       110-READ-INPUT-FILE-EXIT.
           EXIT.

       200-PROCESS-DATA.
      ******************************************************************
      * THIS PROCEDURE CONTROLS THE MAIN PROCESS                       *
      * CALLS:                                                         *
      * CALLED BY:  000-MAINLINE                                       *
      ******************************************************************
      D    DISPLAY '200-PROCESS-DATA'.

           SET     INPUT-NOT-EOF TO TRUE.
           PERFORM 110-READ-INPUT-FILE THRU 110-READ-INPUT-FILE-EXIT.

           PERFORM UNTIL INPUT-EOF
                   MOVE INPUT-REC TO WS-INPUT
                   COMPUTE WS-SUM = WS-SUM + WS-INPUT
                   PERFORM 110-READ-INPUT-FILE THRU
                           110-READ-INPUT-FILE-EXIT
           END-PERFORM.

           DISPLAY 'THE SUM IS ' WS-SUM.

      D    DISPLAY '200-PROCESS-DATA-EXIT'.
       200-PROCESS-DATA-EXIT.
           EXIT.

       300-FINISH.
      ******************************************************************
      * THIS PROCEDURE                                                 *
      * CALLS:                                                         *
      * CALLED BY:  000-MAINLINE                                       *
      ******************************************************************
      D    DISPLAY '300-FINISH'.

           CLOSE INPUT-FILE.
           IF INPUT-FILE-IO-OKAY
              CONTINUE
           ELSE
              DISPLAY '************************************'
              MOVE '300: CLOSE FAILED FOR INPUT FILE' TO ABEND-MSG
              MOVE INPUT-FILE-STATUS TO ABEND-STATUS
              DISPLAY '************************************'
              PERFORM 999-ABEND-ERROR THRU 999-ABEND-ERROR-EXIT
           END-IF.

      D    DISPLAY '300-FINISH-EXIT'.
       300-FINISH-EXIT.
           EXIT.

       999-ABEND-ERROR.
      ******************************************************************
      * THIS PROCEDURE CAUSES THE PROGRAM TO STOP IN THE EVENT OF AN   *
      * ERROR AND INHIBITS FURTHER PROCESSING.                         *
      * CALLS:      STOP-RUN.                                          *
      ******************************************************************

      D    DISPLAY '999-ABEND-ERROR'.
           DISPLAY '*************ERROR*********************'.
           DISPLAY 'TEMPPGM  ENCOUNTERED A FATAL ERROR'.
           DISPLAY ABEND-MSG.

           IF ABEND-STATUS IS NOT  = SPACES
              DISPLAY 'ABEND-STATUS = ',  ABEND-STATUS
           END-IF.
           DISPLAY '*************ERROR*********************'.

           PERFORM STOP-RUN.

      D    DISPLAY '999-ABEND-ERROR-EXIT'.
       999-ABEND-ERROR-EXIT.
           EXIT.

       STOP-RUN.
           STOP RUN.

RUN JCL
Code:

//STEP010 EXEC PGM=TEMPPGM                                             
//STEPLIB  DD DSN=SHEKAR.COBOL.LOAD,DISP=SHR                           
//SYSPRINT DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSUT1   DD *                                                         
1                                                                       
2                                                                       
3                                                                       
4                                                                       
5                                                                       
6                                                                       
7                                                                       
8                                                                       
9                                                                       
10                                                                     
/*

ABEND OUTPUT
Code:

IGD103I SMS ALLOCATED TO DDNAME STEPLIB                                         
IEF237I JES2 ALLOCATED TO SYSPRINT                                             
IEF237I JES2 ALLOCATED TO SYSOUT                                               
IEF237I JES2 ALLOCATED TO SYSUT1                                               
IEC020I 001-4,SHEKARR ,STEP010 ,SYSUT1  ,JES                                   
IEC020I EROPT IS 'ABE' OR NOT SPECIFIED                                         
CEE0374C CONDITION = CEE3250C TOKEN = 00040CB2 61C3C5C5 00000000               
         WHILE RUNNING PROGRAM IGG019AH                                         
         AT THE TIME OF INTERRUPT                                               
         PSW     078D1000 00DD6A6E                                             
         GPR 0-3 80000000 80001000 005C4000 00006DA8                           
         GPR 4-7 00006CE0 005C4054 00006CA8 00DD66A0                           
         GPR 8-B 00008100 00006D5C 005CF298 40DD66B2                           
         GPR C-F 00000000 00006C58 005EC2F0 00000000       
IEA995I SYMPTOM DUMP OUTPUT                                                     
SYSTEM COMPLETION CODE=001                                                     
 TIME=18.49.49  SEQ=04775  CPU=0000  ASID=0029                                 
 PSW AT TIME OF ERROR  078D1000   00DD6A6E  ILC 2  INTC 0D                     
   NO ACTIVE MODULE FOUND                                                       
   NAME=UNKNOWN                                                                 
   DATA AT PSW  00DD6A68 - 00181610  0A0D0000  00238000                         
   GR 0: 80000000   1: 80001000                                                 
      2: 005C4000   3: 00006DA8                                                 
      4: 00006CE0   5: 005C4054                                                 
      6: 00006CA8   7: 00DD66A0                                                 
      8: 00008100   9: 00006D5C                                                 
      A: 005CF298   B: 40DD66B2                                                 
      C: 00000000   D: 00006C58                                                 
      E: 005EC2F0   F: 00000000                                                 
 END OF SYMPTOM DUMP                                                           
IEF472I SHEKARR STEP010 - COMPLETION CODE - SYSTEM=001 USER=0000 REASON=00000000

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Mon Aug 21, 2006 9:45 am    Post subject: Reply with quote

Shekar,

Change this
Code:

01 INPUT-REC         PIC 9(02).

to
Code:

01 INPUT-REC         PIC 9(80).

________
strawberry cough


Last edited by coolman on Sat Feb 05, 2011 1:49 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Aug 21, 2006 9:55 am    Post subject: Reply with quote

shekar123,

you are getting the abend because you have defined the INPUT-REC as 9(02) instead of x(80). Look at superk's file declaration and compare it with yours.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 21, 2006 10:32 am    Post subject: Reply with quote

Kolusu and Coolman,

Thanks for your replies.Can i not have an input file with 9(02) , why do we have to declare it only as X(80) ? Please let me know the reasons for declaring X(80).
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Aug 21, 2006 10:44 am    Post subject: Reply with quote

Quote:

Thanks for your replies.Can i not have an input file with 9(02) , why do we have to declare it only as X(80) ? Please let me know the reasons for declaring X(80).


Shekhar123,

The default DCB parameters for a instream data is 80 Bytes and recfm of FB

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 21, 2006 11:11 am    Post subject: Reply with quote

Kolusu,

I have clearly understood the reason and thanks for you response.I am somehow getting my desired output but still some flaw is there in the code and i had debugged but not able to make out where is the problem.I am getting the sum of the numbers displayed two times which means the end of the file is not encountered and finally it ends upto error which is really not.Can you let me know where is the flaw in the code ?
Code:

       INPUT-OUTPUT SECTION.                                           
       FILE-CONTROL.                                                   
           SELECT INPUT-FILE   ASSIGN TO SYSUT1                         
                  FILE STATUS IS INPUT-FILE-STATUS.                     
                                                                       
       DATA DIVISION.                                                   
       FILE SECTION.                                                   
       FD  INPUT-FILE                                                   
           RECORDING MODE IS F                                         
           DATA RECORD IS INPUT-REC.                                   
                                                                       
       01 INPUT-REC         PIC X(80).                                 
                                                                       
       WORKING-STORAGE SECTION.                                         
       01 WS-VARIABLES.                                                 
          05 WS-INPUT            PIC 9(02)  VALUE 0.                   
          05 WS-SUM              PIC 9(02)  VALUE 0.                   
                                                                       
       01  WS-FLAGS.                                                   
           05 INPUT-EOF-SWITCH            PIC X(01) VALUE SPACE.       
              88 INPUT-NOT-EOF            VALUE 'Y'.                   
              88 INPUT-EOF                VALUE 'N'.                   
                                                                       
       01  WS-FILE-STATS.                                               
           05  INPUT-FILE-STATUS             PIC  X(02) VALUE ZERO.     
               88 INPUT-FILE-IO-OKAY         VALUE '00'.               
               88 INPUT-FILE-END             VALUE '10'.               
                                                                       
       01  WS-LITERALS.                                                 
           05 ABEND-MSG                PIC X(80).                       
           05 ABEND-STATUS             PIC X(02).                       
                                                                       
       PROCEDURE DIVISION.                                             
       000-MAINLINE.                                                   
                                                                       
           PERFORM 100-STARTUP      THRU 100-STARTUP-EXIT.             
           PERFORM 200-PROCESS-DATA THRU 200-PROCESS-DATA-EXIT.         
           PERFORM 300-FINISH       THRU 300-FINISH-EXIT.               
                                                                       
       100-STARTUP.                                                     
      D    DISPLAY '100-STARTUP'.                                       
                                                                       
           OPEN INPUT INPUT-FILE.                                       
           EVALUATE INPUT-FILE-STATUS                                   
              WHEN '00'                                                 
                   CONTINUE                                             
              WHEN OTHER                                               
                   DISPLAY '*********** ERROR *******************'     
                   MOVE '100:OPEN FAILED FOR INPUT-FILE' TO ABEND-MSG   
                   MOVE INPUT-FILE-STATUS               TO ABEND-STATUS
                   DISPLAY "*********** ERROR *******************"     
                   PERFORM 999-ABEND-ERROR THRU 999-ABEND-ERROR-EXIT   
           END-EVALUATE.                                               
                                                                       
      D    DISPLAY '100-STARTUP-EXIT'.                                 
       100-STARTUP-EXIT.                                               
           EXIT.                                                       
                                                                       
       110-READ-INPUT-FILE.                                             
      ******************************************************************
      * THIS PROCEDURE                                                 *
      * CALLS:                                                         *
      * CALLED BY:  200-PROCESS-DATA                                   *
      ******************************************************************
      D    DISPLAY '110-READ-INPUT-FILE'.                               
                                                                       
           INITIALIZE INPUT-REC.                                       
           READ INPUT-FILE                                             
           AT END                                                       
                SET INPUT-EOF  TO TRUE                                 
           NOT AT END                                                   
                IF INPUT-FILE-STATUS IS EQUAL TO '00'                   
                   CONTINUE                                             
                ELSE                                                   
                   MOVE '110:READ FAILED FOR INPUT FILE' TO ABEND-MSG   
                   MOVE INPUT-FILE-STATUS   TO ABEND-STATUS             
                   PERFORM 999-ABEND-ERROR  THRU 999-ABEND-ERROR-EXIT   
                END-IF                                                 
           END-READ.                                                   
                                                                       
      D    DISPLAY '110-READ-INPUT-FILE-EXIT'.                         
       110-READ-INPUT-FILE-EXIT.                                       
           EXIT.                                                       
                                                                       
       200-PROCESS-DATA.                                               
      ******************************************************************
      * THIS PROCEDURE CONTROLS THE MAIN PROCESS                       *
      * CALLS:                                                         *
      * CALLED BY:  000-MAINLINE                                       *
      ******************************************************************
      D    DISPLAY '200-PROCESS-DATA'.                                 
                                                                       
           SET     INPUT-NOT-EOF TO TRUE.                               
           PERFORM 110-READ-INPUT-FILE THRU 110-READ-INPUT-FILE-EXIT.   
                                                                       
           PERFORM UNTIL INPUT-EOF                                     
                   MOVE INPUT-REC(1:2) TO WS-INPUT                     
                   COMPUTE WS-SUM = WS-SUM + WS-INPUT                   
                   PERFORM 110-READ-INPUT-FILE THRU                     
                           110-READ-INPUT-FILE-EXIT                     
           END-PERFORM.                                                 
                                                                       
           DISPLAY 'THE SUM IS ' WS-SUM.                               
                                                                       
      D    DISPLAY '200-PROCESS-DATA-EXIT'.                             
       200-PROCESS-DATA-EXIT.                                           
           EXIT.                                                       
                                                                       
       300-FINISH.                                                     
      ******************************************************************
      * THIS PROCEDURE                                                 *
      * CALLS:                                                         *
      * CALLED BY:  000-MAINLINE                                       *
      ******************************************************************
      D    DISPLAY '300-FINISH'.                                       
                                                                       
           CLOSE INPUT-FILE.                                           
           IF INPUT-FILE-IO-OKAY                                       
           ELSE                                                         
              DISPLAY '************************************'           
              MOVE '300: CLOSE FAILED FOR INPUT FILE' TO ABEND-MSG     
              MOVE INPUT-FILE-STATUS TO ABEND-STATUS                   
              DISPLAY '************************************'           
              PERFORM 999-ABEND-ERROR THRU 999-ABEND-ERROR-EXIT         
           END-IF.                                                     
                                                                       
      D    DISPLAY '300-FINISH-EXIT'.                                   
       300-FINISH-EXIT.                                                 
           EXIT.                                                       
                                                                       
       999-ABEND-ERROR.                                                 
      ******************************************************************
      * THIS PROCEDURE CAUSES THE PROGRAM TO STOP IN THE EVENT OF AN   *
      * ERROR AND INHIBITS FURTHER PROCESSING.                         *
      * CALLS:      STOP-RUN.                                          *
      ******************************************************************
                                                                       
      D    DISPLAY '999-ABEND-ERROR'.                                   
           DISPLAY '*************ERROR*********************'.           
           DISPLAY 'TEMPPGM  ENCOUNTERED A FATAL ERROR'.               
           DISPLAY ABEND-MSG.                                           
                                                                       
           IF ABEND-STATUS IS NOT  = SPACES                             
              DISPLAY 'ABEND-STATUS = ',  ABEND-STATUS                 
           END-IF.                                                     
           DISPLAY '*************ERROR*********************'.           
                                                                       
           PERFORM STOP-RUN.                                           
                                                                       
      D    DISPLAY '999-ABEND-ERROR-EXIT'.                             
       999-ABEND-ERROR-EXIT.                                           
           EXIT.                                                       
                                                                       
       STOP-RUN.                                                       
           STOP RUN.                                                   

OUTPUT
Code:

THE SUM IS 55                                   
THE SUM IS 09                                   
*************ERROR*********************         
TEMPPGM  ENCOUNTERED A FATAL ERROR             
                                               
ABEND-STATUS =                                 
*************ERROR*********************         

RUN JCL
Code:

//SYSUT1   DD *                                                     
 1                                                                     
 2                                                                     
 3                                                                     
 4                                                                     
 5                                                                     
 6                                                                     
 7                                                                     
 8                                                                     
 9                                                                     
10                                                                     
/*                                                                     
//                                                                     

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Mon Aug 21, 2006 11:21 am    Post subject: Reply with quote

Shekar,

Try coding a STOP RUN like this. I believe your code is falling through.

Code:

000-MAINLINE.                                                   
                                                                       
           PERFORM 100-STARTUP      THRU 100-STARTUP-EXIT.             
           PERFORM 200-PROCESS-DATA THRU 200-PROCESS-DATA-EXIT.         
           PERFORM 300-FINISH       THRU 300-FINISH-EXIT.               
           STOP RUN.       
       100-STARTUP.                                     

________
silver surfer reviews


Last edited by coolman on Sat Feb 05, 2011 1:50 am; edited 1 time in total
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 21, 2006 11:27 am    Post subject: Reply with quote

Great Coolman,

It is working and thanks a lot.By the way can you let me know why is it falling through even though i am setting / why is it reading again after the end of the file reached condition.
Code:

READ INPUT-FILE                                             
AT END                                                       
     SET INPUT-EOF  TO TRUE                                 

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Mon Aug 21, 2006 12:47 pm    Post subject: Reply with quote

Shekar,

Setting the EOF condtion to true doesn't stop the flow of the program. Your program processes the paragraphs in the following sequence: 100-STARTUP-PARA , then 200-PROCESS-PARA, inside of which it goes, reads the files and sets the EOF condition to true. Now, control returns back to 200-EXIT and then finally you get into 300-PARA where you close the file. Ideally, your program should stop executing now because you've completed all the required processing. Now the program goes to execute the next statement within para 100-START-UP, because that's the next line and you don't have any statement to indicate that you have to HALT the exeuction of this program. It proceeds further to read the file again not knowing that the EOF had already been reached which causes the abend condition to be flagged.
________
extreme q vaporizer


Last edited by coolman on Sat Feb 05, 2011 1:50 am; edited 1 time in total
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 21, 2006 1:47 pm    Post subject: Reply with quote

Coolman,

Thanks for your valuable explanation and i am very much clear now to avoid coding such type of flaws and it was nice learning experience.
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group