revise C for JCC compatibility
Some checks failed
MVS Delete Members / delete-members (push) Failing after 13s
MVS Submit & Execute / upload-and-run (push) Failing after 51s

This commit is contained in:
Greg Gauthier 2026-02-08 15:43:02 +00:00
parent 68e46fef6b
commit ed41b95105
2 changed files with 12 additions and 39 deletions

View File

@ -2,4 +2,4 @@
// NOTIFY=@05054,CLASS=A,MSGCLASS=H,
// MSGLEVEL=(1,1),REGION=4M,TIME=1440
//STEP1 EXEC JCCCLG,INFILE='@05054.SRCLIB.C(TXTWKR01)'
//GO.TESTDD DD DSN=@05054.DATA(TESTMEM),DISP=SHR
//GO.TESTDD DD DSN=@05054.DATA(TESTMEM),DISP=SHR

View File

@ -1,49 +1,22 @@
#include <stdio.h>
#include <errno.h>
#define BUFFER_SIZE 256
/* Simple program to read and append to a single PDS member via DD name. */
/* Author: Greg Gauthier */
/* Date: 2026-02-08 */
/* NOTE: No single-line comments due to MVS SYSIN/JCL interpretation. */
int main()
{
FILE *fp_read;
FILE *fp_append;
char buffer[BUFFER_SIZE];
FILE *fp;
char buf[256];
/* First: open for reading only to dump current content */
fp_read = fopen("dd:TESTDD", "r");
if (fp_read == NULL)
{
perror("fopen read failed");
printf("errno = %d\n", __errno());
fp = fopen("dd:TESTDD", "r");
if (fp == NULL) {
printf((char *)"fopen read failed\n");
return 1;
}
printf("Existing content:\n");
while (fgets(buffer, BUFFER_SIZE, fp_read) != NULL)
{
printf("%s", buffer);
printf((char *)"Existing content:\n");
while (fgets(buf, 256, fp) != NULL) {
printf((char *)"%s", buf);
}
fclose(fp_read);
/* Second: open for append only to add the new line */
fp_append = fopen("dd:TESTDD", "a");
if (fp_append == NULL)
{
perror("fopen append failed");
printf("errno = %d\n", __errno());
return 1;
}
fprintf(fp_append, "Appended from C program!\n");
fclose(fp_append);
printf("Append complete.\n");
fclose(fp);
printf((char *)"Read complete.\n");
return 0;
}
}