Life, the Internet, and Everything!

Cool RPG Snippets

These are great little snippets of code in RPG. I’ll post more as I find them.

No more hard-coded maximum for looping through an array. If the array size is changed in the future, you don’t have to worry about it.

for i = 1 to %elem(array);
// whatever…
endfor;

Use SQL for data conversions.

exec SQL set :text = lower(:text) or exec SQL set :text = lcase(:text)
exec SQL set :text = upper(:text) or exec SQL set :text = ucase(:text)

 

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/sqlref/src/tpc/db2z_scalarfunctionsintro.html

Leave a Reply

Your email address will not be published. Required fields are marked *