Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Removing header and Trailer from Input using DFSORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Wed Jun 24, 2009 6:40 pm    Post subject: Removing header and Trailer from Input using DFSORT
Reply with quote

Hi all,

This is my requirement,

I have a input file which contains first 5 lines as header and Last one line as trailer,

Eg :

Header
Header
Header
Header
Header

N number of Data lines

Trailer

I need to select only 5 records for each key in datalines. I'm using this step for the same,

Code:


SELECT FROM(INDD) TO(OUTDD) ON(97,48,CH) FIRST(5)



Please suggest me how to remove that header and trailer for selecting 5 records for each key in datalines.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jun 24, 2009 9:05 pm    Post subject:
Reply with quote

Do you mean that you don't want the header and trailer records in the output file? Or do you mean that you want the header and trailer records in the output file, but you don't want FIRST(5) to operate on them?

Is there something unique in the header records that identify them?
Is there something unique in the trailer record that identifies it?

What is the RECFM and LRECL of the input file?
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Wed Jun 24, 2009 9:38 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi,

1)Yes.I dont want the header and trailer record in the output file.

2) Header always present in the first 5 lines and There is nothing unique in the header to identify them. But this is the trailer for all the input file,

Code:


<<end of report>>



3) RECFM is FB
LRECL is 245
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Jun 24, 2009 10:13 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//INDD DD DSN=...  input file (FB/245)
//OUTDD DD DSN=...  output file (FB/245)
//TOOLIN DD *
SELECT FROM(INDD) TO(OUTDD) ON(97,48,CH) FIRST(5) USING(CTL1)
/*
//CTL1CNTL DD *
  OPTION SKIPREC=5
  OMIT COND=(1,17,CH,EQ,C'<<end of report>>')
/*
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Wed Jun 24, 2009 10:31 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi,

Thanks its working!!!

Could you please explain me this Solution!!!!
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Wed Jun 24, 2009 10:34 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

HI Frank,

Thanks!!!!

No need of explanation!! I got it!!!!
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Thu Jun 25, 2009 3:31 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi Frank,

I'm facing a problem in this step. I guess if i can show you my input we can sort this issue!!

My input file looks like this :

xxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyy
---------------------------------------
aaaaa bbbbb ccccc ddddd eeeee
---------------------------------------
01 1111 1000 AAA 180585 FRANK12 EFGHIJK DESC FOR EFGHI
01 1111 1000 AAA 123456 VIGNESH ABCDEF DESC FOR ABCDEF
ABCDEF DESC FOR ABCDEF

<<<< end OF REPORT >>>>

i'm copying first 5 occurences based on the values highlighted in bold.
In my third row of my input the first Six columns are missing.If it is empty , What i wanna do is i want to copy the previous row first six columns to output.

This is the icetool step im using

Code:

//TOOLIN   DD *                                                   
   SELECT FROM(INDD) TO(OUTDD) ON(97,48,CH) FIRST(5) USING(CTL1) 
//CTL1CNTL DD *                                                   
   OPTION SKIPREC=5                                               
   OMIT COND=(111,24,CH,EQ,C'< < < END OF REPORT > > >')         
//*                                                               
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Jun 25, 2009 8:58 pm    Post subject:
Reply with quote

Your description of what you want to do is unclear and your example is confusing.

I think you want to fill in the blank fields from the previous record, but it's not clear exactly what you can have. For example, can you only have one record with non-blank fields followed by one record with blank fields per key like this:

Code:

01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF



Or can you have one record with non-blank fields followed by multiple records with non-blank fields per key like this:

Code:

01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF


Or can you have mixed non-blank and blank records per key like this:

Code:

01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF
01 1111 1000 BBB 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
                                 ABCDEF   DESC FOR ABCDEF


Please show a better example of your input records with all of the possible variations and the expected output records. Use ubb code tags around your input and output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of each relevant field.
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 3:10 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi frank,

My input will be like this,

Code:


01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
                                 CGBEFG   DESC FOR CGBEFG
                                 ASWERT   DESC FOR ASWERT
01 1111 1000 BBB 222222 FRANKAB  ABCDEF   DESC FOR ABCDEF
                                 ASWERT   DESC FOR ABCDEF


my output should look like this,

Code:


01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
01 1111 1000 AAA 123456 VIGNESH  CGBEFG   DESC FOR CGBEFG
01 1111 1000 AAA 123456 VIGNESH  ASWERT   DESC FOR ASWERT                                                   
01 1111 1000 BBB 222222 FRANKAB  ABCDEF   DESC FOR ABCDEF
01 1111 1000 BBB 222222 FRANKAB  ASWERT   DESC FOR ABCDEF



RECFM = FB and LRECL=245

I hope this one helps.
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 3:12 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi frank,

My input will be like this,

Code:


01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
                                 CGBEFG   DESC FOR CGBEFG
                                 ASWERT   DESC FOR ASWERT
01 1111 1000 BBB 222222 FRANKAB  ABCDEF   DESC FOR ABCDEF
                                 ASWERT   DESC FOR ABCDEF


my output should look like this,

Code:


01 1111 1000 AAA 123456 VIGNESH  ABCDEF   DESC FOR ABCDEF
01 1111 1000 AAA 123456 VIGNESH  CGBEFG   DESC FOR CGBEFG
01 1111 1000 AAA 123456 VIGNESH  ASWERT   DESC FOR ASWERT                                                   
01 1111 1000 BBB 222222 FRANKAB  ABCDEF   DESC FOR ABCDEF
01 1111 1000 BBB 222222 FRANKAB  ASWERT   DESC FOR ABCDEF



RECFM = FB and LRECL=245

I hope this one helps.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 26, 2009 6:49 pm    Post subject:
Reply with quote

Vigneshwaran S,

You haven't told the position of the blank fields. I assumed it as pos 1 and we would push down the value if it is not spaces.


Code:

//STEP0100 EXEC PGM=ICETOOL   
//TOOLMSG  DD SYSOUT=*       
//DFSMSG   DD SYSOUT=*       
//IN       DD DSN=your input 245 fb file,DISP=SHR
//OUT      DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
  SELECT FROM(IN) TO(OUT) ON(97,48,CH) FIRST(5) USING(CTL1)
//CTL1CNTL DD *                                                 
  OPTION SKIPREC=5                                               
  OMIT COND=(111,24,CH,EQ,C'< < < END OF REPORT > > >')
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,31,CH,NE,C' '),PUSH=(1:1,31))
//*
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 8:28 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi Kolusu,

Thanks !!!!

My Input :
Code:


01 1111 1000 AAA 123456 VIGNESH 123.24  ABCDEF   DESC FOR ABCDEF
                                234.56  CGBEFG DESC FOR CGBEFG
                                125.35  ASWERT DESC FOR ASWERT
01 1111 1000 BBB 222222 FRANKAB 125.35  ABCDEF   DESC FOR ABCDEF
                                125.35 ASWERT   DESC FOR ABCDEF


I'm missing thise values after decimal point!!!!


Output i'm getting :

Code:


01 1111 1000 AAA 123456 VIGNESH 123 ABCDEF   DESC FOR ABCDEF
01 1111 1000 AAA 123456 VIGNESH 234 CGBEFG   DESC FOR CGBEFG
01 1111 1000 AAA 123456 VIGNESH 125 ASWERT   DESC FOR ASWERT                                                   
01 1111 1000 BBB 222222 FRANKAB 125   ABCDEF   DESC FOR ABCDEF
01 1111 1000 BBB 222222 FRANKAB 125  ASWERT   DESC FOR ABCDEF
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 8:44 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

Hi all,

There is a small correction in input,

Code:


01 1111 1000 AAA 123456 VIGNESH 1,233.24  ABCDEF   DESC FOR ABCDEF
                                234.56    CGBEFG   DESC FOR CGBEFG
                                125.35    ASWERT   DESC FOR ASWERT
01 1111 1000 BBB 222222 FRANKAB 125.35    ABCDEF   DESC FOR ABCDEF
                                1,253.35  ASWERT   DESC FOR ABCDEF



I'm getting values in Thousand with comma separator.

This is the sort step i'm using,

Code:


OPTION SKIPREC=5                                                 
OMIT COND=(111,24,CH,EQ,C'< < < END OF REPORT > > >')           
INREC IFTHEN=(WHEN=GROUP,BEGIN=(5,70,CH,NE,C' '),PUSH=(5:1,70)) 
INREC IFTHEN=(WHEN=GROUP,BEGIN=(86,9,UFF,D,C' '),PUSH=(86:86,9))



Please suggest where i'm going wrong.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 26, 2009 8:55 pm    Post subject:
Reply with quote

Vigneshwaran S,

Where did you invent that syntax? That is NOT a valid syntax of DFSORT. How do you expect us to help you without knowing how your data looks like ? You never answered frank's question about the position and format of the blank field. I changed your control cards to Valid syntax of DFSORT.

Try these control cards.

Code:

//CTL1CNTL DD *                                                   
  OPTION SKIPREC=5                                                 
  OMIT COND=(111,24,CH,EQ,C'< < < END OF REPORT > > >')           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(5,70,CH,NE,C' '),PUSH=(5:5,70)),
  IFTHEN=(WHEN=GROUP,BEGIN=(86,9,CH,NE,C' '),PUSH=(86:86,9))       
//*
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 8:57 pm    Post subject:
Reply with quote

Hi All,

I want my output with decimal point,

Example :

Code:


01 1111 1000 AAA 123456 VIGNESH 1,233.24  ABCDEF   DESC FOR ABCDEF
01 1111 1000 AAA 123456 VIGNESH  234.56    CGBEFG   DESC FOR CGBEFG
01 1111 1000 AAA 123456 VIGNESH  125.35    ASWERT   DESC FOR ASWERT
01 1111 1000 BBB 222222 FRANKAB 125.35    ABCDEF   DESC FOR ABCDEF
01 1111 1000 BBB 222222 FRANKAB 1,253.35  ASWERT   DESC FOR ABCDEF


Please suggest me some ideas.
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 9:08 pm    Post subject:
Reply with quote

Hi kolusu,

Sorry! I should have answered frank question!!! I totally forgot after seeing the input to the DFSORT JCL with Decimal values.

Data was changing everytime. I have got the desired output.
Thanks a lot!!

I have one more question,

Is it possible to sample the data using Two fields from input ?

For Example :

Code:


SELECT FROM(INDD) TO(OUTDD) ON(97,48,CH) FIRST(5) USING(CTL1)



I want to sample based on (97,48,CH,AND,9,10,CH).
Back to top
View user's profile Send private message
Vigneshwaran S
Warnings : 1

New User


Joined: 10 Dec 2008
Posts: 60
Location: Chennai

PostPosted: Fri Jun 26, 2009 9:12 pm    Post subject: Reply to: Removing header and Trailer from Input using DFSOR
Reply with quote

hI KOLUSU,

i got the solution.I have used the following card,

Code:

SELECT FROM(INDD) TO(OUTDD) ON(9,10,CH) ON(97,48,CH) FIRST(5) - 
USING(CTL1)                                                     


Thank you all for posting me patiently!!!!!!!

I have learnt some DFSORT.

Thank you!!!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Removing Extra Spaces in a comma sepa... Puspojit DFSORT/ICETOOL 3 Tue Sep 13, 2016 7:46 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us