Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Performing arithmetic operation on a string variable.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
vissubhai

New User


Joined: 07 Nov 2007
Posts: 12
Location: Hyderabad

PostPosted: Wed Aug 06, 2008 10:46 am    Post subject: Performing arithmetic operation on a string variable.
Reply with quote

Hi All...this is Viswanath. Nice to see various complex REXX problems and their solutions here.

Coming to my problem...

I have an input file which is a basic EZT macro for a file record layout. That is my input file is a FB file with lrecl=80. And it contains:

FIELD-NAME START-POSN LENGTH DATA-TYPE
FILE1-RECORD 1 100 A
FILE1-COUNTRY 1 10 A
FILE1-GROUP 11 8 N

etc.

Now reading this file sequentially, I am creating a SORT SYMNAMES(symbolic names)

That is my output file should be like:
FILE1-RECORD,1,100,CH
FILE1-COUNTRY,1,10,CH
FILE1-GROUP,11,8,ZD etc.

I am using the WORD function to extract the field-name, starting-position, length, and the data-type like:

varName = word(OUTLOG.i,1)
starPos = word(OUTLOG.i,2)
varLen = word(OUTLOG.i,3)
varType = word(OUTLOG.i,4)

and then concatenating the above variables with commas like:

outrec = varName || ',' || startPos || ',' || varLen || ',' || varType

The problem is for variable length files, we need to add 4 for the starting-position field becaus of RDW(Record descriptor word).

That is I need to add 4 for the starPos field. As this is a string variable, it is giving me "Bad arithmetic conversion" abend.

Can anyone help me out if I can perform this addition on this string field.

Let me know if you require more information. Awaiting for your response.

Thanks in Advance,
Vissubhai.
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Aug 06, 2008 12:05 pm    Post subject:
Reply with quote

Why not use the TRANSLATE function to translate all of the nasty blank spaces into loveable little commas ?
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2086
Location: Silicon Valley

PostPosted: Wed Aug 06, 2008 10:27 pm    Post subject: Reply to: Performing arithmetic operation on a string variab
Reply with quote

Perhaps you have a data record that does not have numeric value there??

Use TRACE to determine what is wrong with data.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Wed Aug 06, 2008 10:29 pm    Post subject:
Reply with quote

how are you initializing start pos? '0' or 0?
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us