MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reformatting data

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Thu Aug 17, 2006 10:11 am    Post subject: Reformatting data Reply with quote

I'm having the following data in a file that I want to change using a rule. Please see the sample data below.

Input
Code:

123456789
012345678
001234567
000123456
000012345
000001234
000000123
000000012
000000001

Output should be as follows.

Output
Code:

120000000
120000000
120000000
120000000
120000000
120000000
120000000
120000000
100000000

Is it possible to reformat using DFSORT? I'm not sure my shop has the latest release installed.
The file is FB with LRECL 325. The position of the field is 174 and length is 9.
Please help.
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 17, 2006 10:33 am    Post subject: Reply with quote

Ace,

Here's a DFSORT job that will do what you asked for. However, you will need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) to use JFY. If you don't have the April, 2006 PTF installed, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/325)
//SORTOUT DD DSN=...  output file (FB/325)
//SYSIN    DD    *
  OPTION COPY
* Left-justify, removing leading zeros.
  INREC OVERLAY=(174:174,9,JFY=(SHIFT=LEFT,PREBLANK=C'0'),
* Ensure first two bytes, including blanks, are converted to
* ZD digits and add 7 ZD 0's.
    174:174,2,ZD,TO=ZD,C'0000000')
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Thu Aug 17, 2006 11:06 am    Post subject: Reply with quote

Thanks Frank.
Unfortunately I do not have the required PTF installed and I'm not in a position to request for an update (Since we are not authorized to contact them). I'm getting an error in JFY=(SHIFT=LEFT,PREBLANK=C'0'). Could you please tell me whether any other option available.
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
coolman
Intermediate


Joined: 03 Jan 2003
Posts: 283
Topics: 27
Location: US

PostPosted: Thu Aug 17, 2006 11:20 am    Post subject: Reply with quote

ace,

If REXX is an option, try this

Code:

/* REXX - SPN */                                   
ARG VAR1                                           
VAR1 = SUBSTR(STRIP(VAR1,,'0'),1,2,'0')||'0000000'
SAY VAR1                                           

________
buy herbalaire


Last edited by coolman on Sat Feb 05, 2011 1:48 am; edited 1 time in total
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Aug 17, 2006 11:52 am    Post subject: Reply with quote

ace,

try these control cards

Code:

//SYSIN    DD *                                   
  OPTION COPY                                     
  INREC FIELDS=(001,325,                           
                174,009,ZD,DIV,+10000000,EDIT=(TT))
  OUTREC FIELDS=(001,173,                         
                 326,002,                         
                 C'0000000',                       
                 183,143)                         


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Thu Aug 17, 2006 12:12 pm    Post subject: Reply with quote

Kolusu
This is working only for the first condition
ie : 123456789 changed to 120000000
All other instances it is giving all zeros like, 000000000
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 17, 2006 12:13 pm    Post subject: Reply with quote

Kolusu,

I think you misread the requirement. Dividing by +10000000 is not equivalent to removing the leading zeros to get the first two significant digits. When I run your statements, I get the following for SORTOUT which does not match the required output:

Code:

120000000
010000000
000000000
000000000
000000000
000000000
000000000
000000000
000000000

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Aug 17, 2006 12:24 pm    Post subject: Reply with quote

Ace,

You said that DFSORT flagged JFY. Since it didn't flag OVERLAY, it appears you do have the Dec, 2004 PTF, so you can use this more complicated set of IFTHEN clauses to do what you want:

Code:

  OPTION COPY                                         
  INREC IFTHEN=(WHEN=(174,9,CH,EQ,C'000000000'),       
     OVERLAY=(174:C'000000000')),                     
    IFTHEN=(WHEN=(174,8,CH,EQ,C'00000000'),           
     OVERLAY=(174:182,1,C'00000000')),                 
    IFTHEN=(WHEN=(174,7,CH,EQ,C'0000000'),             
     OVERLAY=(174:181,2,C'0000000')),                 
    IFTHEN=(WHEN=(174,6,CH,EQ,C'000000'),             
     OVERLAY=(174:180,2,C'0000000')),                 
    IFTHEN=(WHEN=(174,5,CH,EQ,C'00000'),               
     OVERLAY=(174:179,2,C'0000000')),                 
    IFTHEN=(WHEN=(174,4,CH,EQ,C'0000'),               
     OVERLAY=(174:178,2,C'0000000')),                 
    IFTHEN=(WHEN=(174,3,CH,EQ,C'000'),                 
     OVERLAY=(174:177,2,C'0000000')),                 
    IFTHEN=(WHEN=(174,2,CH,EQ,C'00'),                 
     OVERLAY=(174:176,2,C'0000000')),                 
    IFTHEN=(WHEN=(174,1,CH,EQ,C'00'),                 
     OVERLAY=(174:175,2,C'0000000')),                 
    IFTHEN=(WHEN=NONE,                                 
     OVERLAY=(174:174,2,C'0000000'))                   

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Aug 17, 2006 12:47 pm    Post subject: Reply with quote

oops sorry. I totally misunderstood the requirement.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ace
Beginner


Joined: 24 Feb 2004
Posts: 58
Topics: 23

PostPosted: Thu Aug 17, 2006 1:15 pm    Post subject: Reply with quote

Thank you very much Frank.
This solution works fine.
_________________
Thank You
-Ace
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group