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 

C - problem with dynamic allocate

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


Joined: 16 Sep 2004
Posts: 6
Topics: 3

PostPosted: Fri Sep 17, 2004 9:05 am    Post subject: C - problem with dynamic allocate Reply with quote

There is a C-Subroutine where I do dyn. allocate as:
Code:

system( "ALLOC DD(FT05F001) NEW DELETE DSORG(PS) RECFM(F B)
        "LRECL(80) BLKSIZE(0) UNIT(VIO) BLOCK(80) SPACE(1 5)
        "AVGREC(K)" ) )
after that I do:
fopen( "DD:FT05F001", "w" );
If I call that C-Subr by  C-Main , all works correctly, but if I call that by
Stored procedure - all crashed..
I replaced "system" to CallTso(...)
static long CallTSO (char *cmd)                                   
{                                                                 
   long flags, cmd_length, return_code, reason_code, abend_code;   
                                                                   
   flags       = 0x00010101;                                       
   cmd_length  = strlen (cmd);                                     
   return_code = reason_code = abend_code = 0;                     
                                                                   
   IKJEFTSR (&flags                                               
            ,&cmd[0]                                               
            ,&cmd_length                                           
            ,&return_code                                         
            ,&reason_code                                         
            ,&abend_code);                                         
                                                                   
   if (return_code != 0) {                                         
      printf ("TSO call failed: %s\nRc: %d\nRe: %d\nAb: %d\n"     
             ,cmd, return_code, reason_code, abend_code);         
      return 12;                                                   
   } /* endif */                                                   
                                                                   
   return 0;                                                       
                                                                   
} /* CallTSO */       


than "ALLOCATE" command seems to succeed, but the dataset is not DD'ed...
May be you know what is the matter?

Thank's in advance.
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: Fri Sep 17, 2004 9:36 am    Post subject: Reply with quote

The reason for the failure when you call from a stored procedure is that a stored procedure does not run in a tso enviroment. So you need to eastablish the tso enviroment using 'IKJTSOEV' .

I prefer using BPXWDYN for dynamic allocation. check this link for documentation of BPXWDYN

http://www.mvsforums.com/helpboards/viewtopic.php?t=2520&highlight=bpx%2A

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
bnm1014
Beginner


Joined: 16 Sep 2004
Posts: 6
Topics: 3

PostPosted: Mon Sep 20, 2004 7:46 am    Post subject: Reply with quote

Excuse me, I'm young mainframe programmer...
Could you tell me how tso environment is usually established?

Thank's in advance.
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 Sep 20, 2004 8:20 am    Post subject: Reply with quote

bnm1014,

You can establish a TSO/E environment outside of the TSO/E TMP and Service Routines using the TSO/E environment service (IKJTSOEV).

Check this link which explains in detail about Using the TSO/E Environment Service IKJTSOEV

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IKJ4B730/3.0?DT=20020521164428

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
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