IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is it possible to have a variable in a substring


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cvishu

Active User


Joined: 31 Jul 2007
Posts: 136
Location: india

PostPosted: Fri Nov 14, 2014 4:07 am
Reply with quote

Hi ,

Formula => Part1+Part2=Part3

SELECT SUBSTR(Formula ,1,5)

can the above select be put inside loop something like below

Do below untill WS-variable < 15 , increrment WS-variable by 5
SELECT SUBSTR(Formula ,WS-Variable,5)
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Nov 19, 2014 2:59 am
Reply with quote

Use a LOCATE function to get a length/ start point into (WS-Variable) and then do a SubStr.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top