Code:
- // Invocation
- string = formatString(itemNumber) + ','
- + formatString(vendorItem.vivnno) + ','
- + %char(qtyAvail) + ','
- + formatString(%trim(warehouse(i).info.address1) + ' '
- + %trim(warehouse(i).info.address2)) + ','
- + formatString(warehouse(i).info.city) + ','
- + formatString(warehouse(i).info.stateCode) + ','
- + formatString(warehouse(i).info.postalCode) + ','
- + formatString(warehouse(i).info.phone);
- Stmf_writeln(fd : %addr(string) : %len(%trim(string)));
-
-
- **************************************************************************
- * Write Line
- **************************************************************************
- P Stmf_writeln B export
- D Stmf_writeln PI 10i 0
- D fd 10i 0 value
- D string * value
- D len 10i 0 value
- *
- D eol s 2a
- D rc s 10i 0
- *
- /free
- // check the length
- if (len > 0);
- rc = writef(fd : string : len);
- if (rc < 1);
- // Set the error message if an error occured
- if (fd < 0);
- error.message = %str(strerror(errno));
- error.number = errno;
- endif;
- return rc;
- endif;
- endif;
-
- // write the end of line charaters
- eol = newline;
- rc = writef(fd : %addr(eol) : %len(eol));
- return rc;
- /end-free
- *
- P Stmf_writeln E
-
-
- P String_replace B Export
- D String_replace PI 65535a varying
- D string * value options(*string)
- D oldChars 1024a const varying options(*varsize)
- D newChars 1024a const varying options(*varsize)
- *
- D oldLen s 10i 0
- D newLen s 10i 0
- D pos s 10i 0
- D returnString s 65535a varying
- /free
- returnString = %str(string);
- oldLen = %len(oldChars);
- newLen = %len(newChars);
- if (newLen = 0);
- newLen = 1;
- endif;
-
- pos = %scan(oldChars : returnString);
- dou (pos = 0);
- if (pos > 0);
- returnString = %replace(newChars : returnString : pos : oldLen);
- if ((pos + newLen) > %len(string));
- leave;
- else;
- pos = %scan(oldChars : returnString : (pos + newLen));
- endif;
- endif;
- enddo;
-
- return returnString;
- /end-free
- *
- P String_replace E
|
|