Correction needed



IBM's Command List programming language & Restructured Extended Executor

Correction needed

Postby balamurali cl » Thu Sep 06, 2012 7:22 pm

 /* REXX */                                                 
 DUH_USER = USERID()                                         
 DSN=DUH_USER'.DATASET.LIST'                                 
 Y = DSNSEE(DSN)                                             
 ADDRESS TSO                                                 
 'ALLOC F(OUT) DA('DSN') NEW TRACKS SPA(60 45) ' ,           
 ' LRECL(80) RECFM(F B) BLKSIZE(9040) DSORG(PS)'             
 IF RC > 0 THEN                                             
   DO                                                       
     SAY 'ALLOCATION FAILED RC=:' RC                         
     ADDRESS TSO 'FREE F(OUT)'                               
   END                                                                 
     EXIT                                                   
 DSNSEE: PROCEDURE                                                                     
         PARSE ARG DSN                                       
         DSN = "'"DSN"'"                                     
         ADDRESS TSO                                         
         X = SYSDSN(DSN)                                     
         IF X ¬= 'OK' THEN RETURN DSN                       
         ELSE                                               
            DO                                               
              ADDRESS TSO DELETE DSN                         
              IF RC = 0 THEN SAY 'DELETED'                   
              ELSE SAY 'NOT DELETED'                         
              RETURN DSN                                     
            END                                             


In the above code when a particular user executes with 'EX' option then it checks if the dataset userid.data.list exist or not. If exits it deletes and then allocates. If it doent exists it allocates.

But here it checks it whethere the dataset exist and gets deleted. But when allocating it tells the dataset exits.because if the user id is A for example. The dataset it checks for is 'A.DATASET.LIST' but while allocating it is 'A.A.DATASET.LIST'.

here is the error:

IKJ56893I DATA SET A.A.DATASET.LIST NOT ALLOCATED+
IGD17101I DATA SET A.A.DATASET.LIST
NOT DEFINED BECAUSE DUPLICATE NAME EXISTS IN CATALOG
RETURN CODE IS 8 REASON CODE IS 38 IGG0CLEH
ALLOCATION FAILED RC=: 12
IKJ56247I FILE OUT NOT FREED, IS NOT ALLOCATED
balamurali cl
 
Posts: 36
Joined: Mon Sep 03, 2012 9:01 pm
Has thanked: 2 times
Been thanked: 0 time

Re: Correction needed

 

Re: Correction needed

Postby Akatsukami » Thu Sep 06, 2012 7:32 pm

Remember that if a data set name is not enclosed in single quotes in TSO, it will be prefixed with the specified user's HLQ (usually, but not always, the TSO ID). Change the ALLOCATE command to:
"ALLOC F(OUT) DA('"DSN"') NEW TRACKS SPA(60 45) " ,           
" LRECL(80) RECFM(F B) BLKSIZE(9040) DSORG(PS)"       
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Correction needed

Postby balamurali cl » Thu Sep 06, 2012 7:40 pm

Superb...Thanks for the gun point...it worked now)
balamurali cl
 
Posts: 36
Joined: Mon Sep 03, 2012 9:01 pm
Has thanked: 2 times
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post