Query Related to SORT



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Query Related to SORT

Postby Vineet » Tue Aug 17, 2010 6:32 pm

My Requirement is I need to Reformat the File. Below I am Providing the Input Data & Desired Output Format.

Input Rec,
1         16     Hello How R U
2          8      MAINFRAME
19        2      COBOL
2          18    JCL


Expected O/P:

00000001 000000016 Hello How R U
00000002 00000008   Mainframe
00000019 00000002   COBOL
00000002 000000018  JCL

Rgds

Vineet
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: Query Related to SORT

 

Re: Query Related to SORT

Postby skolusu » Tue Aug 17, 2010 9:40 pm

vineet,

What are the rules to reformat the data? What is the length of each field? are the numbers right justified? or left justified?
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Query Related to SORT

Postby Vineet » Thu Aug 19, 2010 1:37 pm

Hi SKOLUSU,

Below is My requirement Along with Attributes of File:

File Attribute: LRECL = 1000, Blksize = 0, RECFM = FB.

Records Appearing in INPUT File:
Input Rec:
1 16 Hello How R U ---> ( Value 1 Followed by 8 Spaces,16 Followed by 7 Spaces. Both left Justified)
2 8 MAINFRAME ---> ( Value 2 Followed by 8 Spaces,8 Followed by 8 Spaces. Both left Justified)
19 2 COBOL ---> ( Value 19 Followed by 7 Spaces,2 Followed by 8 Spaces. Both left Justified)
12 18 JCL ---> ( Value 12 Followed by 7 Spaces,18 Followed by 7 Spaces. Both left Justified)

Output Rec:
000000001 000000016 Hello How R U ( 8 Zeros Followed by 1, 7 Zeros followed by 16. Both Right Justified)
000000002 000000008 Mainframe ( 8 Zeros Followed by 2, 8 Zeros followed by 8. Both Right Justified)
000000019 000000002 COBOL ( 7 Zeros Followed by 19,8 Zeros followed by 2. Both Right Justified)
000000012 000000018 JCL ( 7 Zeros Followed by 12, 7 Zeros followed by 18. Both Right Justified)

Note: Length Of Both The Fields need To be Formatted is 9 Byte.

Thanks
Kind Rgds

Vineet Anand
Vineet
 
Posts: 86
Joined: Tue Jun 19, 2007 11:38 am
Has thanked: 0 time
Been thanked: 0 time

Re: Query Related to SORT

Postby skolusu » Thu Aug 19, 2010 10:14 pm

Vineet,

Use the following JCL. I assumed that both numeric fields are at pos 1 and 10.


//STEP0100 EXEC PGM=SORT               
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD DSN=Your input 1000 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                       
  SORT FIELDS=COPY                     
  INREC BUILD=(01,9,UFF,M11,LENGTH=9, 
               10,9,UFF,M11,LENGTH=9, 
               19,982)           
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post