|
|
| Author |
Message |
kranti
New User
Joined: 10 Oct 2005 Posts: 21
|
|
|
|
Hi All,
Would any one please suggest a solution for the below requirement.
We have to extract only header (1st record) and trailer (last record) from a file, but we dont have any specific indicator to know the record type i.e. header/detail/trailer.
Please suggest a solution for this requirement.
Many thanks in advance,
Kranti & Sarma. |
|
| Back to top |
|
 |
References
|
|
 |
shankar.v
Active User
Joined: 25 Jun 2007 Posts: 182 Location: Bangalore
|
|
|
|
kranti,
Please check with the following code for your requirement
| Code: |
// EXEC PGM=SORT
//SORTIN DD DSN=INFILE,DISP=OLD
//SORTOUT DD DSN=OUTFILE,DISP=OLD
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,STOPAFT=1
/*
// EXEC PGM=FILEAID
//DD01 DD DSN=INFILE,DISP=OLD
//DD01O DD DSN=OUTFILE,DISP=MOD
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
$$DD01 COPYBACK OUT=1
/*
// |
|
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
Kranti,
You can use a DFSORT job like the one below to do what you asked for. I assumed your input file has RECF=FB and LRECL=80, but the job can be changed appropriately for other attributes.
| Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=(1,80),
TRAILER1=(1,80)
/*
|
|
|
| Back to top |
|
 |
uchekala
New User
Joined: 01 Nov 2007 Posts: 5 Location: chennai
|
|
|
|
Hi Frank,
if i try your method i am getting the below error.
| Code: |
********************************* TOP OF DATA **********************************
1ICE143I 0 BLOCKSET COPY TECHNIQUE SELECTED
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES A
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 10:42 ON THU NO
0 OPTION COPY
OUTFIL REMOVECC,NODETAIL,
HEADER=(1,5818),
$
ICE213A 0 INVALID OUTFIL STATEMENT OPERAND
TRAILER=(1,5818)
$
ICE005A 0 STATEMENT DEFINER ERROR
ICE751I 0 C5-K20802 C6-K90007 C7-K90000 C8-K90007 E7-K11698
ICE052I 3 END OF DFSORT
******************************** BOTTOM OF DATA ********************************
|
|
|
| Back to top |
|
 |
Alain Benveniste
Active User
Joined: 14 Feb 2005 Posts: 90
|
|
|
|
Upendra,
You didn't copy/paste properly Frank's example !
Alain |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
Upendra,
You used HEADER instead of HEADER1 and TRAILER instead of TRAILER1.
But you didn't say your records were 5818 bytes. The method I showed will only work for up to 256 bytes. To get 5818 bytes, you'd need to use 23 p,m fields which is probably not practical.
Instead, you can use a DFSORT/ICETOOL job like the following:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/5818)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//***> USE MOD FOR OUT DD
//OUT DD DISP=MOD,DSN=... (FB/5818)
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT)
/*
//CTL1CNTL DD *
INREC OVERLAY=(5819:SEQNUM,8,PD)
SORT FIELDS=(5819,8,PD,D)
OUTFIL FNAMES=T1,ENDREC=1,BUILD=(1,5818)
OUTFIL FNAMES=OUT,INCLUDE=(5819,8,PD,EQ,+1),BUILD=(1,5818)
/*
|
|
|
| Back to top |
|
 |
uchekala
New User
Joined: 01 Nov 2007 Posts: 5 Location: chennai
|
|
|
|
thanks Frank,
it's working now if it is FB format.
my input file is VB with lrecl=5818 and i want to convert it into FB and copy only first and last records, could you help me to do it. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
| Quote: |
| my input file is VB with lrecl=5818 and i want to convert it into FB and copy only first and last records |
Why didn't you say that in your first post? It makes a big difference.
If your input file is VB/5818 and you want to convert it to FB, you wouldn't want the RDW in the FB records, so the output length would be 5814, not 5818. Here's a DFSORT/ICETOOL job to do it.
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB/5818)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//***> USE MOD FOR OUT DD
//OUT DD DISP=MOD,DSN=... (FB/5814)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=&&O1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//TOOLIN DD *
SORT FROM(IN) USING(CTL1)
COPY FROM(T1) TO(OUT)
/*
//CTL1CNTL DD *
INREC BUILD=(1,4,5:SEQNUM,8,PD,13:5)
SORT FIELDS=(5,8,PD,D)
OUTFIL FNAMES=T1,ENDREC=1,VTOF,BUILD=(13,5814)
OUTFIL FNAMES=OUT,INCLUDE=(5,8,PD,EQ,+1),VTOF,BUILD=(13,5814)
/*
|
|
|
| Back to top |
|
 |
uchekala
New User
Joined: 01 Nov 2007 Posts: 5 Location: chennai
|
|
|
|
Frank,
It worked for me, thanks a ton... you rocks. |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4577 Location: San Jose, CA
|
|
|
|
You can now do this more easily and efficiently using the new SUBSET operator of DFSORT's ICETOOL available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (VB/5818)
//OUT DD DSN=... output file (FB/5814)
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=OUT,VTOF,BUILD=(5,5814)
/*
|
For complete details on the new SUBSET function and the other new functions available with PTF UK90013, see:
www.ibm.com/systems/support/storage/software/sort/mvs/ugpf/ |
|
| Back to top |
|
 |
|
|
|