Thursday, January 27, 2011
Thursday, January 20, 2011
The IEBCOPY
IEBCOPY is a dataset utility which used to copy or merge members between Partitioned datasets (PDS) or Partitioned datasets Extended (PDSE), fully or partially.
1. Copy selected or all members of one PDS into another.
2. Copy a Partitioned dataset into a unique sequential format known as “ Unloaded Partitioned dataset” which can be FTP, manipulate as a sequential dataset or written to Tape.
3. To read an unloaded Partitioned dataset or restore into a partitioned dataset.
4.Compress PDS( c ) in place to recover free space.
SYSUT1 is the input dataset and SYSUT2 is the output dataset. The above job unload the SYSUT1 pds (PGMG.COBOL.SOURCE ) and write into TAPE, with the PDS name provided in SYSUT2.
This Job read unloaded partitioned dataset from TAPE and write the contents into vol XXXXXX, with the name provided in SYSUT1, 10 tracks and 20 Directory blocks.
E.g.
SELECT statement specifies the members to be processed with the job. If you have used any other ddnames for the datasets other than SYSUT1 or SYSUT2 then you can use OUTDD, INDD parameters to pass the dataset names.
Common uses of IEBCOPY
1. Copy selected or all members of one PDS into another.
2. Copy a Partitioned dataset into a unique sequential format known as “ Unloaded Partitioned dataset” which can be FTP, manipulate as a sequential dataset or written to Tape.
3. To read an unloaded Partitioned dataset or restore into a partitioned dataset.
4.Compress PDS( c ) in place to recover free space.
The ISPF copy options (3.3) use IEBCOPY under the cover. Moving a PDS or PDSE can be easily achieved by IEBCOPY.
Simple IEBCOPY job
//COPYJOB5 JOB SHIBU,REGION=1024K
// EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=SHR,DSN=PGMG.COBOL.SOURCE
//SYSUT2 DD DISP=(NEW,KEEP),UNIT=TAPE,DSN=ARCHIVE.SOURCE,
// VOL=SER=XXXXXX
SYSUT1 is the input dataset and SYSUT2 is the output dataset. The above job unload the SYSUT1 pds (PGMG.COBOL.SOURCE ) and write into TAPE, with the PDS name provided in SYSUT2.
Note: In the above job output dataset name is not same as the input dataset name, however there is no harm in using the same name.
Job to Restore PDS in a volume.
//COPYJOB6 JOB SHIBU,MSGCLASS=X,REGION=1024K
// EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=OLD,UNIT=TAPE,DSN=ARCHIVE.SOURCE,
// VOL=SER=XXXXXX
//SYSUT2 DD DISP=(NEW,CATLG),DSN=PGMG.COBOL.SOURCE,UNIT=3390,
// SPACE=(TRK,(10,10,20)),VOL=SER=XXXXXX
This Job read unloaded partitioned dataset from TAPE and write the contents into vol XXXXXX, with the name provided in SYSUT1, 10 tracks and 20 Directory blocks.
We can also use the above job to move datasets from one volume into another with smaller changes.
//COPYJOB7 JOB 1,SHIBU,MSGCLASS=X,NOTIFY=&SYSUID
// EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DISP=OLD,DSN=PROD.PGMG.C,UNIT=3390,
// VOL=SER=VOL1
//SYSUT2 DD DISP=(NEW,CATLG),DSN=SYSI.PGMG.C1,UNIT=3390,
// SPACE=(TRK,(10,10,20)),VOL=SER=NEWVOL
Instead of using Dummy in the sysin we can specify additional selection criteria to IEBCOPY
E.g.
//SYSIN DD *
COPY OUTDD=SYSUT2,INDD=SYSUT1
SELECT MEMBER=(PGM1,PGM2)
/*
SELECT statement specifies the members to be processed with the job. If you have used any other ddnames for the datasets other than SYSUT1 or SYSUT2 then you can use OUTDD, INDD parameters to pass the dataset names.
Restoring a partitioned data set from an unloaded copy automatically compresses (recovers lost space) the data set.
Wednesday, January 19, 2011
Line Sequential File support in Enterprise Cobol.
IBM has added the support for the input and output of line sequential files to Enterprise COBOL. This allows a Cobol program running in mvs to use data stored in zOS/ Unix/HFS file (HFS – Hierarchical File System, is the is the system used to support z/OS UNIX)
Line sequential Files contain only characters(DISPLAY) data and instead of having pre- recorded boundaries, records are delimited by newline characters (x’15’).
Specify ORGANIZATION IS LINE SEQUENTAL
E.g. If the record length in the line sequential file is 10 and in the FD you given the record length as 200 then after READ, FD-variable will contain 10 characters from Line sequential file followed by 190 blank spaces.
At run time, this external name can have a related DD statement that contains
PATH=’file_path’,FILEDATA=TEXT
Identification Division.
Program-Id. unixfile.
Author . Shibu thannikkunnath.
Environment Division.
Input-Output Section.
FIle-Control.
Select unixfle assign to indd
Organization is line sequential
File status is unixfile-status.
Select zfsfile assign to zfdd
File status is zfsfile-status.
Data division.
File section.
FD unixfle.
01 fs-unix-rec pic x(80).
FD zfsfile.
01 fs-zfs-rec pic x(80).
Working-storage section.
01 unixfile-status pic x(2).
01 zfsfile-status pic x(2).
Eject.
Procedure division.
A00100-MAIN.
Move spaces to unixfile-status.
Perform B00200-WRITE-FILE.
perform C00300-READ-FILE.
stop run.
C00300-READ-FILE.
Open input unixfle.
Display 'Read-Module started'.
If unixfile-status not equal to 00 then
Display 'UNIXFILE-STATUS: ' unixfile-status
Display 'File is not yet ready, Program terminating'
Move 8 to return-code
close unixfle
stop run
else
Perform until unixfile-status = 'en'
read unixfle
at end move 'en'
to unixfile-status
not at end Display fs-unix-rec
end-read
end-perform
close unixfle
end-if.
exit.
B00200-WRITE-FILE.
Open output unixfle.
Open input zfsfile.
Display 'Write-Module Started'.
If unixfile-status not = 00 or zfsfile-status not = 00 then
Display 'UNIXFILE-STATUS: ' unixfile-status
Display 'ZFSFILE-STATUS : ' zfsfile-status
Display 'File is not yet ready, Program terminating'
Move 8 to return-code
close unixfle
close zfsfile
stop run
else
Perform until zfsfile-status = 'en'
read zfsfile
at end move 'en'
to zfsfile-status
not at end
Move fs-zfs-rec
to fs-unix-rec
Write fs-unix-rec
end-read
end-perform
Display 'UNIXFILE-STATUS: ' unixfile-status
Display 'ZFSFILE-STATUS : ' zfsfile-status
close unixfle
close zfsfile
end-if.
exit.
Sample JCL to execute Program
***************************** Top of Data ******************************
//R0318BEJ JOB 'SHIBU THANNIKKUNNATH',REGION=0M,NOTIFY=&SYSUID
//EXECPGM EXEC PGM=UNIXPGM
//INDD DD PATH='/u/workds/helloworld.c',
// FILEDATA=TEXT
//ZFDD DD DSN=TSHRCI.PGMG.C(HLLOWRLD),DISP=SHR
//STEPLIB DD DSN=TSHRCI.LOAD.LIB,DISP=SHR
//SYSIN DD *
/*
//SYSOUT DD SYSOUT=*
//
**************************** Bottom of Data ****************************
Line sequential Files contain only characters(DISPLAY) data and instead of having pre- recorded boundaries, records are delimited by newline characters (x’15’).
Things to consider while writing a COBOL-Line Sequential File program
- Select statement
Specify ORGANIZATION IS LINE SEQUENTAL
- You cannot open a line sequential file in I-O mode and you cannot use REWRITE statement.
- On READ, when a newline character is encountered, it will be replaced with the enough space to fill the record as described after FD.
E.g. If the record length in the line sequential file is 10 and in the FD you given the record length as 200 then after READ, FD-variable will contain 10 characters from Line sequential file followed by 190 blank spaces.
- On WRITE trailing spaces are removed and replaced by single newline character .
Things to consider while writing the JCL.
- The ASSIGN TO clause in select statement names an external name
At run time, this external name can have a related DD statement that contains
PATH=’file_path’,FILEDATA=TEXT
Sample Program
Identification Division.
Program-Id. unixfile.
Author . Shibu thannikkunnath.
Environment Division.
Input-Output Section.
FIle-Control.
Select unixfle assign to indd
Organization is line sequential
File status is unixfile-status.
Select zfsfile assign to zfdd
File status is zfsfile-status.
Data division.
File section.
FD unixfle.
01 fs-unix-rec pic x(80).
FD zfsfile.
01 fs-zfs-rec pic x(80).
Working-storage section.
01 unixfile-status pic x(2).
01 zfsfile-status pic x(2).
Eject.
Procedure division.
A00100-MAIN.
Move spaces to unixfile-status.
Perform B00200-WRITE-FILE.
perform C00300-READ-FILE.
stop run.
C00300-READ-FILE.
Open input unixfle.
Display 'Read-Module started'.
If unixfile-status not equal to 00 then
Display 'UNIXFILE-STATUS: ' unixfile-status
Display 'File is not yet ready, Program terminating'
Move 8 to return-code
close unixfle
stop run
else
Perform until unixfile-status = 'en'
read unixfle
at end move 'en'
to unixfile-status
not at end Display fs-unix-rec
end-read
end-perform
close unixfle
end-if.
exit.
B00200-WRITE-FILE.
Open output unixfle.
Open input zfsfile.
Display 'Write-Module Started'.
If unixfile-status not = 00 or zfsfile-status not = 00 then
Display 'UNIXFILE-STATUS: ' unixfile-status
Display 'ZFSFILE-STATUS : ' zfsfile-status
Display 'File is not yet ready, Program terminating'
Move 8 to return-code
close unixfle
close zfsfile
stop run
else
Perform until zfsfile-status = 'en'
read zfsfile
at end move 'en'
to zfsfile-status
not at end
Move fs-zfs-rec
to fs-unix-rec
Write fs-unix-rec
end-read
end-perform
Display 'UNIXFILE-STATUS: ' unixfile-status
Display 'ZFSFILE-STATUS : ' zfsfile-status
close unixfle
close zfsfile
end-if.
exit.
Sample JCL to execute Program
***************************** Top of Data ******************************
//R0318BEJ JOB 'SHIBU THANNIKKUNNATH',REGION=0M,NOTIFY=&SYSUID
//EXECPGM EXEC PGM=UNIXPGM
//INDD DD PATH='/u/workds/helloworld.c',
// FILEDATA=TEXT
//ZFDD DD DSN=TSHRCI.PGMG.C(HLLOWRLD),DISP=SHR
//STEPLIB DD DSN=TSHRCI.LOAD.LIB,DISP=SHR
//SYSIN DD *
/*
//SYSOUT DD SYSOUT=*
//
**************************** Bottom of Data ****************************
Output in SPOOL
Subscribe to:
Posts (Atom)