z/OS 3.1:

Test msg 10 parm P1: aaaaa P2: bbbbb P3: ccccc P4: ddddd P5: eeeee P6: fffff 
P7: ggggg P8: hhhhh P9: iiiii P10:  P11:  <

Rich Smrcina

> On Oct 2, 2025, at 3:21 PM, Phil Smith III <[email protected]> wrote:
> 
> If so, can you try this trivial program from USS (or the MVS side, I don't 
> care, but it's easier from USS):
> 
> -------------------
> #include<stdio.h>
> int main( int argc, char **argv ){
>   char b[4096];
>   snprintf( b, 4096, "Test msg 10 parm P1: %1$s P2: %2$s P3: %3$s P4: %4$s 
> P5: %5$s P6: %6$s P7: %7$s P8: %8$s P9: %9$s P10: %10$s P11: %11$s 
> <","aaaaa","bbbbb","ccccc","ddddd","eeeee","fffff","ggggg","hhhhh","iiiii","jjjjj","kkkkk");
>   printf( "%s\n", b );
>   return 0;
> }
> -------------------
> 
> * To build (assuming you named it bug.c):
> c89 bug.c
> 
> -------------------
> 
> * Then:
> ./a.out
> 
> -------------------
> 
> * I get this output on my z/OS system:
> Test msg 10 parm P1: aaaaa P2: bbbbb P3: ccccc P4: ddddd P5: eeeee P6: fffff 
> P7: ggggg P8: hhhhh P9: iiiii P10:  P11:  <
> 
> * That should have been:
> Test msg 10 parm P1: aaaaa P2: bbbbb P3: ccccc P4: ddddd P5: eeeee P6: fffff 
> P7: ggggg P8: hhhhh P9: iiiii P10: jjjjj P11: kkkkk <
> 
> -------------------
> 
> It appears that the XLC runtime doesn't handle more than 9 arguments using 
> the %n$s format (at least). We found this because some new code was blowing 
> up, and we of course assumed it was something wrong with one of the many 
> formats (they aren't all just s-type).
> 
> The compiler listings say just:
> 15650ZOS V2.4 z/OS XL C
> 
> I'm hoping someone with a newer version can confirm that this is fixed. We're 
> going to have to work around it anyway, because it's not that hard (we only 
> have one such example) and I'd rather not require an IBM PTF for our 
> customers.
> 
> Thanks...
> 
> ...phsiii
> 
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
> 


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

Reply via email to