/*---------------------------------------------------------------------------*/ /* JSTLFT: Returns &PSTR after removing leading *BLANKs (left-justify). */ /*---------------------------------------------------------------------------*/ JSTLFT: PGM PARM(&PSTR &PSTRLEN) /* */ /* The incoming PSTR is *char(128) with bin(2) in the first two positions */ /* to give *char(130). The bin(2) gives the length. We return the length */ /* back to the caller after we adjust... */ /* */ DCL VAR(&PSTR) TYPE(*CHAR) LEN(130) DCL VAR(&PSTRLEN) TYPE(*DEC) LEN(3) /* */ /* String work areas... */ /* */ DCL VAR(&WRKSTR) TYPE(*CHAR) LEN(128) /* The + working string... */ DCL VAR(&STRLEN) TYPE(*DEC) LEN(3) /* The + working string length... */ DCL VAR(&CHKPOS) TYPE(*DEC) LEN(3) /* A pointer + to the first non-blank character in + WRKSTR... */ /* */ /* The significant data... */ /* */ DCL VAR(&SIGSTR) TYPE(*CHAR) LEN(128) /* The + significant string after left-justify... */ DCL VAR(&SIGLEN) TYPE(*DEC) LEN(3) /* The + significant string length... */ /* */ /* Extract our working string from the parm... */ /* */ CHGVAR VAR(&WRKSTR) VALUE(%SST(&PSTR 3 128)) /* */ /* If only blanks came in, return length zero and get out... */ /* */ IF COND(&WRKSTR *EQ ' ') THEN(DO) CHGVAR VAR(&PSTRLEN) VALUE(0) RETURN ENDDO /* */ /* Initialize our loop control and extract the original length... */ /* */ CHGVAR VAR(&STRLEN) VALUE(%BIN(&PSTR 1 2)) CHGVAR VAR(&CHKPOS) VALUE(1) /* */ /* Loop until we find first non-blank... */ /* */ NXT_CHAR: IF COND(%SST(&WRKSTR &CHKPOS 1) *EQ ' ') THEN(DO) CHGVAR VAR(&CHKPOS) VALUE(&CHKPOS + 1) GOTO CMDLBL(NXT_CHAR) ENDDO /* */ /* Return the results... */ /* */ /* Calculate the significant length... */ CHGVAR VAR(&SIGLEN) VALUE(&STRLEN - &CHKPOS + 1) /* Extract the significant data... */ CHGVAR VAR(%SST(&PSTR 3 128)) VALUE(%SST(&WRKSTR + &CHKPOS &SIGLEN)) /* Return the significant length... */ CHGVAR VAR(&PSTRLEN) VALUE(&SIGLEN) RETURN ENDPGM