(here it is)
... a sample C program and JCL to demonstrate this bug (feature?) of the C fprintf function.
If you try it you will see that a lines are first wrapped into 255-character chunks, and then wrapped again to the LRECL of the output dataset. (This explains all of the examples that you posted above if you look closely).
Code: Select all
//WOLF1LW JOB (),'DOVETAIL',CLASS=B,
// MSGCLASS=H,REGION=0M,NOTIFY=WOLF1
//*
//* JCL to compile and run C stderr line-wrap test
//*
//BLD EXEC PROC=CBCCBG,
// CPARM='OPTFILE(DD:CCOPT)',
// BPARM='COMPAT=MIN',
// OUTFILE='WOLF1.LOADLIB(LINEWRAP),DISP=SHR'
//COMPILE.SYSIN DD *
int main(int argc, char** argv) {
char buf[600];
char digits[11] = "0123456789";
int len;
memset(buf, 0, sizeof(buf));
// write sucessive lines between 5 and 550 characters in length
for (len=5; len<=550; len++) {
// the first 4 characters of each line are "nnn:"
buf[0] = '\0';
sprintf(buf, "%3.3d", len);
buf[3] = ':';
// each successive line is one digit longer
buf[len-1] = digits[len % 10];
fprintf(stderr, "%s\n\n", buf);
}
}
//COMPILE.CCOPT DD *
LANGLVL(EXTENDED)
FLOAT(IEEE)
TARGET(OSV2R10)
//BIND.SYSPRINT DD DUMMY
//*
//* The following are different options for SYSOUT DCB.
//* (Uncomment the one you want to try)
//*
//* In each case, a line-break is somehow inserted after each
//* 255 bytes that are written in a line (before normal line-wrapping
//* occurs).
//*
//* Note that for RECFM=VB, the max line length should be LRECL-4
//* .. for RECFM=VBA,the max line length should be LRECL-5
//* .. for RECFM=FB, the max line length should be LRECL
//* .. for RECFM=FBA,the max line length should be LRECL-1
//*
//* Question: whats the most efficient for JES Sysout (VB or FB)?
//* Should blksize be specified, or just take default?
//*
//*GO.SYSOUT DD SYSOUT=*
//GO.SYSOUT DD SYSOUT=*,DCB=(RECFM=VBA,LRECL=133)
//*GO.SYSOUT DD SYSOUT=*,DCB=(RECFM=VBA,LRECL=137)
//*GO.SYSOUT DD SYSOUT=*,DCB=(RECFM=VB,LRECL=136)
//*GO.SYSOUT DD SYSOUT=*,DCB=(RECFM=FB,LRECL=132)
//*GO.SYSOUT DD SYSOUT=*,DCB=(RECFM=FBA,LRECL=133)
//