× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Robert

Have a string of 27 alpha characters, A to Z followed by another A and then
use QCLSCAN to find the position matching the current character from your
member name. Increment that position by one to find the next character in
the sequence. The following CL source shows an example:

/* Receive a single input parameter containing an alphabetical character and
*/
/* return the next character in sequence to the calling procedure...
*/
PGM PARM(&INCHAR &OUTCHAR)



DCL VAR(&INCHAR) TYPE(*CHAR) LEN(1)

DCL VAR(&OUTCHAR) TYPE(*CHAR) LEN(1)



/* Variable &SEQ contains the sequence of characters to use. Note we use a
*/
/* sequence of 27 characters to allow for auto-wrapping of the sequence...
*/
DCL VAR(&SEQ) TYPE(*CHAR) LEN(27) +

VALUE('ABCDEFGHIJKLMNOPQRSTUVWXYZA')

DCL VAR(&POS) TYPE(*DEC) LEN(3 0)



/* Scan for the current character...
*/
CALL PGM(QCLSCAN) PARM(&SEQ X'026F' X'001F' +

&INCHAR X'001F' '0' '0' ' ' &POS)



/* Return the next character in the sequence. If the original character
*/
/* isn't in the sequence then we return a value of "A"...
*/
CHGVAR VAR(&POS) VALUE(&POS + 1)
CHGVAR VAR(&OUTCHAR) VALUE(%SST(&SEQ &POS 1))

ENDPGM

Hope it helps

Jonathan



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Robert Munday
Sent: 03 August 2007 16:25
To: Midrange Systems Technical Discussion
Subject: Incrementing An Alpha Value In CL

Today's task is to increment an alpha value in a CL (A to B to C...). As
some batch files process, I am to save the successfully processed file
members to an archive file and assign a batch ID character on the end of
each unique member name. I have a file identifer + Julian Date + AlphaSeq,
which for today would be `FL07215A`. If I process a second batch today, it
woud be `FL07215B`. I can capture the highest value of the eighth character
in the file member name with RTVMBRD - RtvMbrD File(FILENAME) Mbr(*Last)
RtnMbr(&LASTMEMBER) as the member names would be in ascending order. I
could then bump the character to the next value and append it to the first
seven characters of the member name.

Sure, I could write an RPG program to do this, but there must be a
relatively painless way to do it within a CL. Were it my project, a numeric
sequence would be the most simple to accomplish.

How to proceed?

Thanks,


Robert Munday
Munday Software Consultants
Montgomery, AL
on assignment in Nashville, TN



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.