View previous topic :: View next topic
|
Author |
Message |
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
I got a requirement to extract only header n trailer from a PS file and write them into a seperate file.
Can anyone help me with a JCL using Sort commands. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
How to identify the record is header or trailer? |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
try this
Code: |
//**********************************************************************
//* SELECTS HEADER AND TRAILER RECORD
//* IE. 1ST AND LAST RECORD
//**********************************************************************
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file
//SORTOUT DD DSN=output file
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=(1,80),
TRAILER1=(1,80)
|
Gerry |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Or even
Code: |
//S1 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD input dataset
//OUT DD output dataset
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST LAST
/* |
|
|
Back to top |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
Its working fine.
Thnks |
|
Back to top |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
Sambhaji N gerry. I need some more from u people.
I got a requirement to extract only header n trailer from a PS file and write them into a seperate file and I need a count(no of records) as well in another file.
Can anyone help me with a JCL using Sort commands. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Code: |
//S1 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD input dataset
//OUT DD output dataset1
//OUT1 DD output dataset2
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST LAST
COUNT FROM(IN) WRITE(OUT1)
/*
|
|
|
Back to top |
|
|
Binaya
New User
Joined: 03 Jul 2007 Posts: 77 Location: Hyderabad
|
|
|
|
Hi Guys
Thnks for the reply.
SUBSET Keyword is not working in my Mainframe as it has older version of ICETOOL.
Can you suggest me a JCL using DFSORT for extracting Header n trailer regardless of the input file length.
The subject posted by GERRY is working fine but I can process input file with 80 bytes long only which is specific.
FOR EXAMPLE:
In the Cycle 1 execution I may get a 80 bytes long file but cycle2 execution I may get a 160 bytes file. So I need a JCL which can extract Header N trailer from the Input file regardless of its length using DFSORT only.
Thnks in advance. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi, In above job, by mistake I pasted wrong code..
correct one is
Code: |
//S1 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD DSN=input dataset with 211 lrecl
//OUT DD DSN=output dataset with 4096 lrecl
//TOOLIN DD *
SUBSET FROM(IN) TO(OUT) KEEP INPUT FIRST LAST USING(CTL1)
/*
//CTL1CNTL DD *
INREC OVERLAY=(1,211,4096:X)
/*
|
|
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
If SUBSET is not working at your shop use below
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=input file
//SORTOUT DD DSN=output file
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1,211,4096:X)
OUTFIL REMOVECC,NODETAIL,
HEADER1=(1,211),
TRAILER1=(1,211)
|
|
|
Back to top |
|
|
|