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

DATASORT - To add Header and Sort the records


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

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 21, 2011 5:18 pm
Reply with quote

My scenario is i have to include the same header in the splitted (10 files). so all the splitted files will have the same header. For an example i have used only one output file below,

Kindly have a look,

Code:
Header in the file:

<<Header>>

Code:
Input file:

010001
020002


I used the DATASORT to append and tried to sort, it wasn't looked fine


Code:
//*-----        -----------                                       
//STEP100  EXEC PGM=ICETOOL                                       
//*-----        -----------                                       
//TOOLMSG   DD SYSOUT=*                                           
//DFSMSG    DD SYSOUT=*                                           
//IN        DD DSN=ABC.TEST.INPUT,DISP=SHR
//OUT       DD DSN=ABC.TEST.OUTPUT,         
//             DISP=(NEW,CATLG,DELETE),UNIT=DISK,                 
//             SPACE=(CYL,(5,5),RLSE),RECFM=FB,LRECL=14,         
//             BLKSIZE=1400,BUFNO=20                               
//TOOLIN     DD *                                                 
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)               
/*                                                                 
//CTL1CNTL  DD *                                                   
  SORT FIELDS=(1,3,CH,A)                                           
/*   


The output i got it was

Code:
Current output:

0100001
0200002
<<Header>>


The header comes descending, which i want in ascending.

Please guide me how to append the header from other file to Output file and sorted with header , should look like the below

Code:
Desired Output

<<Header>>
0100001
0200002


Kindly guide.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Feb 21, 2011 5:20 pm
Reply with quote

Add-on:

Since i have around 30 splitted files. I want to do it in a single sort. I.e is appending the header records and sort it with a single sort card.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Feb 22, 2011 3:01 am
Reply with quote

Quote:
For an example i have used only one output file below,


This isn't very helpful. Show a better example of your input file and more than one output file.

It's not clear if you have one input file (with the header and data records) or two input files (one with the header and another with the data records).
You need to make that clear.

How are you splitting the files?

DATASORT operates on input files that already have a HEADER and/or TRAILER record. It doesn't really look like that's your situation, so you need to describe more clearly what your situation is - that is, what files you're using for the header, input and output and what they contain.

Also, it doesn't look like you have a trailer record, so why are you using TRAILER?

Basically, you need to explain more clearly what exactly it is you're trying to do.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Feb 22, 2011 9:44 am
Reply with quote

I apologise for the shortly explained. The required detail as follows

Basically my input file is an extract file. Using that file i am splitting up the output files to an of 28 no of files. After splitting up the files i want to insert an HEADER which is present in another single file which also has the same LRECL of Splitted output files.

Code:
Sorted output files:
LRECL: 1374

Header:
LRECL: 1374
 
 1: INPUT - Header File
28: OUTPUT - Splitted Files

I am splitting up the files using below,
//SYSIN DD*
//OUTFIL INCLUDE=(COND),FNAMES=OUT1
...
...
//OUTFIL INCLUDE=(COND),FNAMES=OUT28



And i would like to add the header and sort the records in all the 28 splitted output files by adding the new step below the split step.
As you said, i havent used TRAILER in the file. I will remove it.

Kindly advise.
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Tue Feb 22, 2011 11:36 pm
Reply with quote

Below are the test input file

LRECL: 1370

Code:

INPUT
900011 123456789999999999999999999999999999
900002 123456789675545455555555555555555555
900003 123456777777777777777777777777777777
SAN THE HEADER


Code:
OUTPUT
SAN THE HEADER
900011 12123456789999999999999999999999999999
900002 123456789675545455555555555555555555
900003 123456777777777777777777777777777777


I want to move the header to first position by not sorting the rest of records. Is it possible. Please advise.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Feb 22, 2011 11:57 pm
Reply with quote

Sigh. Your explanations are quite confusing and contradictory. You show an example of the input with the "header" as the last record, but you also say
Quote:
After splitting up the files i want to insert an HEADER which is present in another single file.
So is the header in the same input file or in another input file?

Quote:
And i would like to add the header and sort the records in all the 28 splitted output files by adding the new step below the split step.


What does this mean? What fields are you sorting the records by? Do you want to split them first and then sort them, or sort them first and then split them?

Until you can show a good example of the records in your input file or files, and the records in your expected output files, I can't help you.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Thu Feb 24, 2011 4:05 pm
Reply with quote

Hello,

If you have any constant value in the header record, why not include that condition along with the existing condition to split the file, this way the header record will span to all the output files.

Code:
OUTFIL INCLUDE=(Header condition,OR,Your condition),FNAMES=OUT1
Back to top
View user's profile Send private message
xknight

Active User


Joined: 22 Jan 2008
Posts: 117
Location: Liberty city

PostPosted: Mon Mar 21, 2011 2:49 pm
Reply with quote

Dear Frank

Quote:
Sigh. Your explanations are quite confusing and contradictory. You show an example of the input with the "header" as the last record, but you also say


My Apologies again, the requirement has had couple of options to be worked out, so the contradictory. Finally i figured out by running ample testing. Thank you very much for your time and support. icon_smile.gif

@Kratos,
Yes i did exactly the same, anyways thank you very much for your time and support. icon_smile.gif

Cheers
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 To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
Search our Forums:

Back to Top