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
 

 

Convert fixed length field to variable length field

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Tue May 18, 2010 3:18 pm    Post subject: Convert fixed length field to variable length field
Reply with quote

I know that DFSORT can extract and justify delimited fields like this:

From:
Code:
AAA;1;A2;13.2
AAA;25;A;2.0
AAA;3;A35;521.5
AAA;4;A999;51.7

To:
Code:
AAA; 1;A2  ; 13.2
AAA;25;A   ;  2.0
AAA; 3;A35 ;521.3
AAA; 4;A999; 51.7


But my question is: can DFSORT read a fixed field file and convert it to a variable length field file?

Here is an example of what I want:
From:
Code:
08120092009010100000198
08220092009010100023054
38020092009010100000000

To:
Code:
81;2009;20090101;1,98
82;2009;20090101;230,54
380;2009;20090101;0,00


Bruno Oliveira
Back to top
View user's profile Send private message

Escapa

Senior Member


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

PostPosted: Tue May 18, 2010 3:56 pm    Post subject:
Reply with quote

Quote:
But my question is: can DFSORT read a fixed field file and convert it to a variable length field file?

do you really mean variable length file or semicolon delimited file?



Code:
08120092009010100000198
08220092009010100023054
38020092009010100000000

In above example how to identify fields?
are they fixed length? if yes show the format,starting pos,length of each field.
Back to top
View user's profile Send private message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Tue May 18, 2010 4:17 pm    Post subject: Reply to: Convert fixed length field to variable length fiel
Reply with quote

The example file is this:
Code:
08120092009010100000198
08220092009010100023054
38020092009010100000000


Ant the format is:
Code:
   numeric,  1, 3  ->  PIC 9(3)
   numeric,  4, 4  ->  PIC 9(4)
   numeric,  8, 8  ->  PIC 9(8)
   numeric, 16, 8  ->  PIC 9(6,2)


And I mean semicolon delimited file.

Other example I can give you:
With a PIC S9(7,2) COMP-3 variable:
Code:
00105
0025D

I want to output it like this:
Code:
-120,55


Sorry for my rusty english.
Bruno Oliveira
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue May 18, 2010 4:45 pm    Post subject:
Reply with quote

Your other example is more confusing...
please check below sort step.. which will give output as you have shown in initial post....
Code:

//S1    EXEC  PGM=SORT                                               
//SYSOUT    DD  SYSOUT=*                                             
//SORTIN DD *                                                       
08120092009010100000198                                             
08220092009010100023054                                             
38020092009010100000000                                             
/*                                                                   
//SORTOUT DD SYSOUT=*                                               
//SYSIN    DD    *                                                   
 SORT FIELDS=COPY                                                   
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,ZD,EDIT=(III),C';',             
                               4,4,ZD,EDIT=(IIII),C';',             
                               8,8,ZD,EDIT=(IIIIIIII),C';',         
                              16,6,ZD,EDIT=(IIIIIT),C',',22,2)),     
       IFTHEN=(WHEN=NONE,BUILD=(1,27,SQZ=(SHIFT=LEFT)))             
/*                                                                   

Output will be...
Code:

81;2009;20090101;1,98 
82;2009;20090101;230,54
380;2009;20090101;0,00


Your second and third field looks like year and date. if you want it as it is then use

Code:
//SYSIN    DD    *                                                   
 SORT FIELDS=COPY                                                   
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,3,ZD,EDIT=(III),C';',             
                4,4,C';',8,8,C';',16,6,ZD,EDIT=(IIIIIT),C',',22,2)),     
       IFTHEN=(WHEN=NONE,BUILD=(1,27,SQZ=(SHIFT=LEFT)))             
/*
Back to top
View user's profile Send private message
Bruno Oliveira

New User


Joined: 28 Jan 2010
Posts: 16
Location: Portugal

PostPosted: Tue May 18, 2010 8:15 pm    Post subject:
Reply with quote

Your answer was very helpfull.

Thank you, Escapa.
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Tue May 18, 2010 9:10 pm    Post subject:
Reply with quote

Bruno Oliveira wrote:
Your answer was very helpfull.

Thank you, Escapa.

I am glad it helped.. icon_smile.gif
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm


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