Page 1 of 1

checking line feed using jcl

PostPosted: Thu Apr 29, 2010 4:43 pm
by KEN
Hi,

i am using the below jcl to convert ascii file to ebcdic file. But i want to perform check on the line feed also.

can i do it using the jcl?

//STEP01 EXEC PGM=IKJEFT01,REGION=512K
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//ASCIN DD DSN=ascii dataset,DISP=SHR
//EBCOUT DD DSN=ebcdic dataset,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(168,25),RLSE),
//SYSTSIN DD *
OCOPY INDD(ASCIN) OUTDD(EBCOUT) CONVERT((BPXFX311)) TO1047
/*

regards,
Ken

Re: checking line feed using jcl

PostPosted: Thu Apr 29, 2010 4:51 pm
by MrSpock
What exactly is it that you want to do with it? I've had to write my own process to handle CR/LF conditions on data that I receive from a TCP/IP Socket call.

Re: checking line feed using jcl

PostPosted: Thu Apr 29, 2010 4:55 pm
by Robert Sample
But i want to perform check on the line feed also.
What does this mean?

Re: checking line feed using jcl

PostPosted: Thu Apr 29, 2010 5:02 pm
by KEN
I am having a ASCII file . I have to check if the last two bytes in the file contains X'0D0A' . if yes, then i want to convert the whole file into EBCDIC format. The below jcl converts the ascii file to ebcdic but it doesnot perform the check on last two bytes of the file.

//STEP01 EXEC PGM=IKJEFT01,REGION=512K
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//ASCIN DD DSN=ascii dataset,DISP=SHR
//EBCOUT DD DSN=ebcdic dataset,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(168,25),RLSE),
//SYSTSIN DD *
OCOPY INDD(ASCIN) OUTDD(EBCOUT) CONVERT((BPXFX311)) TO1047
/*

i want to modify this jcl to perform the check first and then do the conversion from ASCII to EBCDIC.

REGARDS,
KEN

Re: checking line feed using jcl

PostPosted: Fri Apr 30, 2010 3:11 am
by dick scherrer
Hello,

What should happen if the "last two bytes in the file" does not contain X'0D0A'?

One easy way to do what you want is to add a step before this step to read the file, check the last 2 bytes of data and set a retuen-code depending on whether the value was found or not.

Re: checking line feed using jcl

PostPosted: Tue May 04, 2010 5:30 pm
by KEN
Thanks dick!

The input ASCII file is having the header and the trailer which donot contain X'0D0A' in the last two bytes.
i want to check if all the lines(except header and trailer)in the input file contains X'0D0A' or not.

The below jcl converts the ASCII file to EBCDIC but it doesnot perform the above check.

//STEP01 EXEC PGM=IKJEFT01,REGION=512K
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//ASCIN DD DSN=ascii dataset,DISP=SHR
//EBCOUT DD DSN=ebcdic dataset,
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(168,25),RLSE),
//SYSTSIN DD *
OCOPY INDD(ASCIN) OUTDD(EBCOUT) CONVERT((BPXFX311)) TO1047
/*

can i modify this jcl to produce the EBCDIC file only if the above condition is satisified, else not.


thanks in advance,

regards,
ken

Re: checking line feed using jcl

PostPosted: Tue May 04, 2010 5:45 pm
by Robert Sample
You will have to write a program to do this check. It would be wise to write the program to run on whatever machine is sending the data to the mainframe.