Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
dilpreet

New User

Joined: 18 Mar 2008
Posts: 34
Location: INDIA

 Posted: Tue Apr 21, 2009 12:17 am    Post subject: Separate the numeric and alphabetic fields into 2 separate f I have one alpha numeric variable of X(50) I want to separate the numeric and alphabetic fields into 2 separate fields. How will i do that? E.G. variable A has value 'a124858sdsfg5525' So B should have asdsfg and C should have 1248585525

Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8339
Location: Dubuque, Iowa, USA

 Posted: Tue Apr 21, 2009 12:19 am    Post subject: What was your answer?
ashishsr123

New User

Joined: 06 May 2008
Posts: 33
Location: Chennai

 Posted: Tue Apr 21, 2009 12:23 am    Post subject: You can code a logic for it i have done it.. do not have the code right now.. But kind of simple.. Use a loop ,,take each character..use function Is numeric ...and if answer si true put it in in a numeric field otherwise put in a alphanumeric field. U can use decimal system for storing digits in numeric field Regards AShish
dick scherrer

Site Director

Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

Posted: Tue Apr 21, 2009 1:35 am    Post subject:

Hello,

 Quote: U can use decimal system for storing digits in numeric field
What is "decimal system"?
dbzTHEdinosauer

Global Moderator

Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

Posted: Tue Apr 21, 2009 2:18 am    Post subject:

Since I am bored:

 Code: ws-alpha-numeric Pic X(50). ws-hold-alpha  pic x(50) value spaces. ws-hold-numeric pic x(50) value spaces. ws-count-alpha  pic s9(3) comp value zero. ws-count-numeric  pic s9(3) comp value zero. ws-sub-prime  pic s9(3) comp. ws-sub-alpha  pic s9(3) comp value 1. ws-sub-numeric pic s9(3) comp value 1. Perform varying ws-sub-prime                  from 1                     by 1                  until ws-sub-prime > 50    If ws-alpha-numeric(ws-sub-prime:1) = 0    or ws-alpha-numeric(ws-sub-prime:1) = 9    or (ws-alpha-numeric(ws-sub-prime:1) > 0         and        ws-alpha-numeric(ws-sub-prime:1) < 9)    then       move ws-alpha-numeric(ws-sub-prime:1) to ws-hold-numeric(ws-sub-numeric)       add 1 to ws-sub-numeric    else       move ws-alpha-numeric(ws-sub-prime:1) to ws-hold-alpha(ws-sub-alpha)       add 1 to ws-sub-alpha    end-if end-perform IF ws-sub-alpha > 1     compute ws-count-alpha = ws-sub-alpha - 1 end-compute end-if IF ws-sub-numeric > 1     compute ws-count-numeric = ws-sub-numeric - 1 end-compute end-if .

if there are any numeric,
you can then NUMVAL from ws-hold-numeric to a numeric field.
ashishsr123

New User

Joined: 06 May 2008
Posts: 33
Location: Chennai

Posted: Tue Apr 21, 2009 9:38 pm    Post subject:

 Quote: U can use decimal system for storing digits in numeric field

Sorry for the confusion...i meant u can store numbers like(in case u have issues...) num1*10 + num*10*2 + num*10*3.......and so on...
dbzTHEdinosauer

Global Moderator

Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

Posted: Tue Apr 21, 2009 10:30 pm    Post subject:

 Quote: Sorry for the confusion...i meant u can store numbers like(in case u have issues...) num1*10 + num*10*2 + num*10*3.......and so on..

you would do this only if you extracted the numbers from back to front,
and for the
units, you would specify num1*10**0
tens, num1*10**1
hundreds, num1*10**2

and not num1*10*1 which would be the number times 10
and not num1*10*2 which would be the number times 20

inaccuracy will wastes time.
(* means multiplication, ** is exponentiation)

and this is not a chat room.
take the time to accurately phrase your posts (use written english)
and use the preview button
the board actually added an edit post button
(yeah I like it too, keeps my flaming to a minimum)
because so many of the computer types here can't figure out how to proof their posts,
as in your case where you could not even explain what you were thinking.

Those are the only issues I have.
Robert Sample

Global Moderator

Joined: 06 Jun 2008
Posts: 8339
Location: Dubuque, Iowa, USA

Posted: Tue Apr 21, 2009 10:37 pm    Post subject:

 Quote: the board actually added an edit post button (yeah I like it too, keeps my flaming to a minimum)
But the entertainment value goes down ... sigh
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am PARSE GDG name to separate generation... Abid Hasan SYNCSORT 2 Sun Feb 11, 2018 3:40 pm Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us