How to increment the value.



IBM's Command List programming language & Restructured Extended Executor

How to increment the value.

Postby samurai » Mon Apr 28, 2014 6:06 pm

Hello,

Could someone help me in incrementing the value from A01 -> A02

code:

"ALLOC FI(V5NAME) DA('"||OUT'('INN.I')'||"')SHR"
"EXECIO * DISKW V5NAME(STEM ICD. FINIS"
"FREE FI(V5NAME)"

here OUT is the output PDS and INN.I is member name

Actual member name is PUWMBA01, i need to write it as PUWMBA02.. Please help!!
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to increment the value.

Postby prino » Mon Apr 28, 2014 6:10 pm

Split, increment and concatenate back.

Sheesh, was that so difficult?
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: How to increment the value.

Postby samurai » Mon Apr 28, 2014 7:12 pm

i can split using SUBSTR as

INN.i = SUBSTR(INPUT_MEM.K,1,5)

and also split

ver = substr(input_mem.k,6,3) this will give A01
ver = ver + 1
may i know to increment????

"ALLOC FI(V5NAME) DA('"||OUT'(mem || ver)'||"')SHR" ----> this didnt work !! please correct me
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to increment the value.

Postby samurai » Mon Apr 28, 2014 7:22 pm

Sorry Prino....I didnt think in another way ;)

Tried by cutting till number and now am able to increment :)
MEM = SUBSTR(INPUT_MEM.K,1,7)
INC = SUBSTR(INPUT_MEM.K,7,2)
INC = INC + 1
SAY INC


it Worked ...Thanks !!
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to increment the value.

Postby Pedro » Mon Apr 28, 2014 10:33 pm

When you convert from alphabetic characters to numeric values, be careful not to lose the leading zero.
Pedro Vera
User avatar
Pedro
 
Posts: 684
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: How to increment the value.

Postby samurai » Tue Apr 29, 2014 10:01 am

Yeah it worked fine.NP. Thanks!
samurai
 
Posts: 30
Joined: Tue Mar 18, 2014 3:29 pm
Has thanked: 6 times
Been thanked: 0 time

Re: How to increment the value.

Postby kir_910 » Wed Sep 07, 2016 2:47 pm

Can you please paste the entire code you used to increment.

I have a requirement, wherein I have to save members toa PDS as PBDRBK01 ,02 and so on upto 30
I am not getting how to increment from 01 to 09, my rexx take as 1-9 instead of 01 to 09
kir_910
 
Posts: 1
Joined: Wed Sep 07, 2016 2:15 pm
Has thanked: 0 time
Been thanked: 0 time

Re: How to increment the value.

Postby NicC » Wed Sep 07, 2016 3:22 pm

Please do not tail-gate an old topic. Start a new one.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to CLIST & REXX