Page 1 of 1

Not getting file status for sequential files in easytrieve

PostPosted: Wed May 25, 2016 7:42 pm
by arya_starc
Not getting thefile status for the sequential files in easytrieve?
below is my code

//STEP1    EXEC PGM=EZTPA00,COND=(0,NE)                                
//STEPLIB  DD  DSN=EZTP.CAILIB,DISP=SHR                                
//PDS      DD  DSN=AVPS.PROD.EZT.CPYLIB,DISP=SHR                        
//NEW      DD  DSN=AVPS.AY.VOUOUT.SE,DISP=SHR                          
//EZTVFM   DD  UNIT=SYSDA,SPACE=(CYL,(5,5),RLSE)                        
//SYSOUT   DD  SYSOUT=*                                                
//SYSDBOUT DD  SYSOUT=*                                                
//SYSIN    DD  *                                                        
*                                                                      
FILE NEW                                                                
NEW-SEQ                         1    154  A                            
NEW-MAIL-CODE                   1      3  A                            
*                                                                      
WS-CHECK                           W     1 A                            
JOB INPUT NEW                                                          
    IF NEW:FILE-STATUS NE 0                                            
       DISPLAY 'NEW FILE IS NOT ABLE TO OPEN'                          
    ELSE                                                                
    DISPLAY 'WS-CHECK....' WS-CHECK                                    
    END-IF                                                              
  STOP                                                                  
 

Re: nOT GETTING THE FILE STATUS FOR SE FILES

PostPosted: Wed May 25, 2016 7:55 pm
by Robert Sample
Google is your friend. Googling easytrieve file status returned, among the 11,100 results, a web page with this:
For Normal Files,
FILE-STATUS = 0 means, Successful GET or PUT or READ or WRITE operation.

GET INFILE
IF INFILE:FILE-STATUS NE 0
DISPLAY 'ERROR IN READING FILE'
END-IF

End of a File can be identified using EOF keyword.
i.e,

IF EOF INFILE
DISPLAY 'END OF FILE'
END-IF

In case of a VSAM file, FILE-STATUS can mean any of the following
FILE-STATUS Meaning
0 Successful operation
4 End of File
8 Duplicate key during a Write/PUT (or)

Additional records with the same key exist in the

alternate index during a GET operation
12 Keys not in Sequence during PUT/WRITE
16 Record not found during READ
Since you are NOT explicitly using GET / READ / PUT / WRITE I suspect you won't be able to use the FILE-STATUS

Re: nOT GETTING THE FILE STATUS FOR SE FILES

PostPosted: Wed May 25, 2016 9:44 pm
by BillyBoyo
Unless you use "STATUS" on the IO operation, you cannot get a "status". So, as Robert suspects, you can't get it on a JOB INPUT ... (Easytrieve Plus will automatically fail if anything really bad happens, you don't need to check it yourself).

Also, they cannot be used except for a limited type of "file". Realistically, these days, that means VSAM, SQL and IMS/DLI.

If you are doing GET processing of a "flat" file, again Easytrieve Plus will automatically fail if anything is discovered to be badly wrong.