IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Extracting only header and trailer from a PS file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Aug 26, 2009 9:37 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 26, 2009 9:50 am
Reply with quote

How to identify the record is header or trailer?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Aug 26, 2009 10:00 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 26, 2009 10:06 am
Reply with quote

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
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Aug 26, 2009 11:08 am
Reply with quote

Its working fine.

Thnks
Back to top
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Wed Aug 26, 2009 11:09 am
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 26, 2009 12:32 pm
Reply with quote

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
View user's profile Send private message
Binaya

New User


Joined: 03 Jul 2007
Posts: 77
Location: Hyderabad

PostPosted: Thu Aug 27, 2009 2:39 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 27, 2009 3:18 pm
Reply with quote

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
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 27, 2009 5:42 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top