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
 

 

reading the SYSIN parm file with in a loop

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
yogi.47eie

New User


Joined: 16 Aug 2006
Posts: 28
Location: india

PostPosted: Tue Sep 05, 2006 1:36 pm    Post subject: reading the SYSIN parm file with in a loop
Reply with quote

Hi ,
I am going to read a SYSIN parm file,with in a loop.Scenario is like this,
I am reading theSYSIN parm file,when i read the 4 th record it is satisfying my condition,then control is coming out of the loop.Next time i am reading the parm file,At that time i am expecting to read the first record again.But when i enter into the loop again my control is going to the 5 th record onwards.Can i read the SYSIN file from the first record?Like a PS file can i close and open the SYSIN parm file ,so that i can read from the first record?
Back to top
View user's profile Send private message

raghunathns

Active User


Joined: 08 Dec 2005
Posts: 127
Location: rochester

PostPosted: Tue Sep 05, 2006 11:29 pm    Post subject: Re: reading the SYSIN parm file with in a loop
Reply with quote

SYSIN is only for instream. it is not possible to read twice.

if you want you can read and store in an array and then process the array. multiple times.

or

use another dd. and work as a seq file.
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Sep 06, 2006 4:47 am    Post subject: Re: reading the SYSIN parm file with in a loop
Reply with quote

yogi.47eie,

Yes, you can, treat it as any other file, use ?SELECT?, ?FD?, ?OPEN/CLODE?.

Code:

FILE-CONTROL.                                         
                                                     
    SELECT SYSIN-FILE                                 
    ASSIGN TO SYSIN.                                 
                                                     
DATA DIVISION.                                       
FILE SECTION.                                         
FD  SYSIN-FILE                                       
    LABEL RECORDS STANDARD                           
    BLOCK CONTAINS 0 RECORDS.                         
01  SYSIN-REC                PIC X(80).               
                                                     
WORKING-STORAGE SECTION.                             
                                                     
LINKAGE SECTION.                                     
                                                     
PROCEDURE DIVISION.                                   
                                                     
PROGRAM-START.                                 
                                               
    OPEN INPUT SYSIN-FILE.                     
                                               
    PERFORM 4 TIMES                             
        READ SYSIN-FILE                         
        DISPLAY SYSIN-REC                       
    END-PERFORM.                               
                                               
    CLOSE SYSIN-FILE.                           
                                               
    OPEN INPUT SYSIN-FILE.                     
                                               
    PERFORM 4 TIMES                             
        READ SYSIN-FILE                         
        DISPLAY SYSIN-REC                       
    END-PERFORM.                               
                                               
    CLOSE SYSIN-FILE.                           

    GOBACK.


JCL
Code:

//JS00100  EXEC PGM=#TEST                         
//STEPLIB  DD DSN=YOUR.PDS.LOADLIB,DISP=SHR
//SYSIN    DD *                                   
RECORD 1                                           
RECORD 2                                           
RECORD 3                                           
RECORD 4                                           
RECORD 5                                           
RECORD 6                                           
RECORD 7                                           
RECORD 8                                           
/*                                                 
//SYSOUT   DD SYSOUT=*                             
//SYSPRINT DD SYSOUT=*


Results

Code:

.SARPAGE 4                   
.                           
.RECORD 1                   
.RECORD 2                   
.RECORD 3                   
.RECORD 4                   
.RECORD 1                   
.RECORD 2                   
.RECORD 3                   
.RECORD 4                   


Dave
Back to top
View user's profile Send private message
yogi.47eie

New User


Joined: 16 Aug 2006
Posts: 28
Location: india

PostPosted: Thu Sep 14, 2006 5:55 pm    Post subject:
Reply with quote

Hi David ,
Thanks a lot ,as per the request they asked us to use the table logic ,it went fine.

Regards
Yogi
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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