Top Examples to Handle Delimiters COBOL, UNIX, JCL

PART-1: How to Work With Delimiter in COBOL

PIPE delimited file we can achieve through MVS record structure, See, the example below

01 INPUT_REC1
05 FIRST-ONE         PIC X(2)
05 SECOND-ONE        PIC X(2) VALUE "||"
.
.
.

The above way, we can construct a record. Similarly we can use UNSTRING in COBOL to delimit the PIPE symbol, and we will get sequential data set.

PART-2: How to Work With Delimiter in JCL

The second best example is we frequently use PIPE concept with SPLIT in DFSORT

//EXAMP JOB A400,PROGRAMMER
//RUNSORT EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=H
//SORTIN DD DSN=INPUT.PIPE,SUBSYS=PIPE,
//          DCB=(LRECL=60,RECFM=FB,BLKSIZE=32760)
//OUT1   DD DSN=OUTPUT.PIPE1,SUBSYS=PIPE,
//          DCB=(LRECL=60,RECFM=FB,BLKSIZE=32760)
//OUT2   DD DSN=OUTPUT.PIPE2,SUBSYS=PIPE,
//          DCB=(LRECL=60,RECFM=FB,BLKSIZE=32760)
//SYSIN  DD *
  OPTION DYNALLOC,FILSZ=U1000000
  SORT FIELDS=(1,20,CH,A,25,4,BI,A)
  OUTFIL FNAMES=(OUT1,OUT2),SPLIT
/*

Here, SUBSYS=PIPE, will allocates input file into PIPE system.
OUTFIL FNAMES=(OUT1,OUT2),SPLIT ==> This command writes input file into two output files.

PART-3: How to Work With Delimiter in UNIX

 The PIPE symbol will be used in UNIX, to separate each command in UNIX. Let us execute the batch job using BPXBTACH utility.

//STEPN  EXEC  PGM=BPXBTACH,PARM = ‘SH ls –a | tail +3 | nl'
//SYSOUT DD SYSOUT=*

Here, in the list of records, it filters the top three records and shows line numbers.

Related Posts