What Unix service would get called from printf? I was curious, so I
wrote a simple program:

---
#include <stdlib.h>                                          
#include <stdio.h>                                           
#define _POSIX_SOURCE                                        
#include <unistd.h>                                          
#pragma linkage(callqdb,OS_NOSTACK)                          
#pragma map(callqdb, "BPX1QDB")                              
                                                             
void callqdb(int * rv,                                       
             int * rc,                                       
             int * rsn                                       
             );                                              
                                                             
void main(int args, char **argv, char **env)                 
{                                                            
int rv, rc, rsn;                                             
char buffer[80];                                             
                                                             
  rv = rc = rsn = 0;                                         
  callqdb(&rv, &rc, &rsn);                                   
  printf("before printf: rv = %08X, rc = %08X, rsn = %08X\n",
         rv, rc, rsn);                                       
  rv = rc = rsn = 0;                                         
  callqdb(&rv, &rc, &rsn);                                   
  printf("after printf:  rv = %08X, rc = %08X, rsn = %08X\n",
         rv, rc, rsn);                                       
  rc = getcwd(buffer, 80);                                   
  printf("rc = %08X, cwd = %s\n", rc, buffer);               
  rv = rc = rsn = 0;                                         
  callqdb(&rv, &rc, &rsn);                                   
  printf("after getcwd:  rv = %08X, rc = %08X, rsn = %08X\n",
         rv, rc, rsn);                                       
}                                                            
---

The output shows that the dub only occured after the getcwd() call:

---
before printf: rv = 00000008, rc = 00000000, rsn = 00000000
after printf:  rv = 00000008, rc = 00000000, rsn = 00000000
rc = 2187E2FC, cwd = /u/sasdtp                             
after getcwd:  rv = 00000001, rc = 00000000, rsn = 00000000
---


In article 
<of50d25821.e29d6e03-on802580dd.004f2c48-802580dd.004f8...@notes.na.collabserv.com>
 you wrote:
> I understood the original question to be how to avoid OMVS and you almost 
> certainly need OMVS for printf. For Metal C I wrote my own printf subset 
> that calls WTO - you at least have varargs.

> Cheers,

> Dave Griffiths
> z/OS Developer
> IBM United Kingdom Limited, Hursley Park, Winchester, SO21 2JN, UK
>  



> From:   David Crayford <[email protected]>
> To:     [email protected]
> Date:   08/03/2017 13:52
> Subject:        Re: Which C library functions imply dub?
> Sent by:        IBM Mainframe Discussion List <[email protected]>



> On 8/03/2017 9:15 PM, David Griffiths1 wrote:
> > Hi, not sure of the definitive answer but you can probably take a guess 
> by
> > comparing with the Metal C library. By definition Metal C calls don't
> > require access to the unix kernel. In fact if you don't want to connect 
> to
> > OMVS why not use Metal C anyway?

> That's a no-brainer! For a simple example how about just being able to 
> use printf().

> > Cheers,
> >
> > Dave Griffiths
> > z/OS Developer
> > IBM United Kingdom Limited, Hursley Park, Winchester, SO21 2JN, UK
> >
> > 
> >
> >
> >
> > From:   Charles Mills <[email protected]>
> > To:     [email protected]
> > Date:   08/03/2017 02:30
> > Subject:        Which C library functions imply dub?
> > Sent by:        IBM Mainframe Discussion List <[email protected]>
> >
> >
> >
> > X-posted from a thread on MVS-OE
> >
> > 
> >
> > How would I determine which standard C library functions imply or cause 
> a
> > dub? (Other than by trying them without an OMVS segment and seeing if 
> they
> > blow up?) Is this documented somewhere? I guess another way of phrasing
> > the
> > question is "how would I determine which standard C library functions 
> are
> > 'UNIX functions'?"
> >
> > 
> >
> > Do most of them? Surely not strlen()? Does fopen()? Only if you 
> reference
> > a
> > UNIX file as opposed to //DD:FOO?
> >
> > 
> >
> > Charles

-- 
Don Poitras - SAS Development  -  SAS Institute Inc. - SAS Campus Drive
[email protected]           (919) 531-5637                Cary, NC 27513

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to