Have you tried reading STDIN and if so does it return data from SYSIN, or try opening SYSIN, as fp = fopen("SYSIN", "r");
Alternatively, try changing the DD name of SYSIN to STDIN. The DD *
says to pull the data from the text lines that follow. It does NOT have to be named SYSIN.
Finally, if all else fails read the C/Mainframe user guide. (I don't have one and it was a long time ago when I wrote on a mainframe, so I forget the particulars.)
Lastly, the first example seems to have a few errors:
// SET P1='RBR1 FIRBS.AIC_REHBFG_FDG.BM '
// SET P2='BGM.LOL_FDSG '
// SET P3='"" '
// SET P4='X F GMHKD'
//ST01 EXEC PGM=VCMBGJF,PARM='&P1.&P2.&P3.&P4'
//* there should be a space between // and PARM
I mention this because the parm data you listed is < 100 chars, so fixing the PARM statement might fix the running of your code.