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
 

 

DATASORT - To add Header and Sort the records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DATASORT - To add Header and Sort the records
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    Post subject: @ add on requirement
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 Moderator


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

PostPosted: Tue Feb 22, 2011 3:01 am    Post subject:
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    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Tue Feb 22, 2011 11:57 pm    Post subject:
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    Post subject:
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    Post subject:
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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