Ideas for new IB Commands


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]

Posted by Jeff Cinelli on April 15, 2018 at 19:01:07: Uploaded files: 1

Over the many years I’ve been programming in Comet, I’ve come up with a few ideas for new commands that I’d like to share. My primary reason for suggesting these is to find ways to reduce code, labels, and simplify some repetitive tasks. There may be nothing earthshaking here, however I welcome feedback, and feel free to point out any existing commands that I may be unaware of.

1. Character Counting. While validating data, it would be good to have a way to quickly determine how many of a specific character(s) are in a given string. For example, while validating an email address, I’d like to know if there is only 1 @ symbol, and at least one dot in the field. Rather than loop through the string and accumulate, it would be great to be able to issue one command. Example:

COUNT=POSCOUNT(“@”,EMAIL$)

If email$ is ‘jcinelli@merisoft.net’, COUNT would return a 1.
If email$ is ‘jeff@cinelli@merisoft.net’, COUNT would return a 2.

2. Enhanced Extended Key File Positioning. Suppose the customer master file has a 5 character subkey for the zip code. There’s no easy way to position to the end of a given key. If we’re at the beginning of key “12345”, and want to skip that key, I haven’t found an easy way to do it. You can’t position to “12345@FF@” if the key is only 5 characters long. It would be great to have a way to position to the end of a subkey. Example:

POSITION (LUN) KEY=ENDKEY(CURRENTKEY$)

Issuing this command would position to the last subkey for CURRENTKEY$. So a subsequent KEY statement would return the next zip code.

3. Date Format Conversion. We have a lot of options currently available for doing date conversions. However, I still find myself continually converting MM/DD/YYYY to YYYYMMDD and vice versa. It would be great to have a command to convert this on the fly. Example:

NEWDATE$=DATEFORMAT(OLDDATE$,x,)

CHAR$ is an optional character to specify the date separator (typically dash or slash).

x=1: Convert MM/DD/YY to YYMMDD
x=2: Convert MM/DD/YYYY to YYYYMMDD
x=3: Convert YYMMDD to MM/DD/YY (With the slashes indicating whatever is in CHAR$)
x=4: Convert YYYYMMDD to MM/DD/YYYY (With the slashes indicating whatever is in CHAR$)

Using the same theory, it would also be nice to be able to quickly validate a date based on the same x value. Example:

ISITGOOD=DATEVALID(MYDATE$,2,)

If MYDATE$ is correctly formatted for MM/DD/YYYY (where the slashes are represented by the value of CHAR$), with valid months, days, and years, ISITGOOD would come back TRUE. Otherwise, ISITGOOD would be FALSE.

4. Clear Screen (Mostly). I’m always wanting to clear the screen, but leave the top line alone. Or 2, or 3. It would be great to be able to optionally specify a starting line for clearing the screen. Example:

PRINT (CS) ! Clear the Screen
PRINT @(0,1);(CS) ! Clear the screen starting at the second line

This would be a lot easier than a lot of (BF) commands.

5. Breaking or Continuing on an exception. If we’re in the middle of a loop, and performing a file operation would cause an exception, we need to add labels before or after the NEXT or LOOP statements. It would be nice to be able to do that without a label. Example:

KEY$=KEY(LUN,EXCPBREAK) ! Exception to the next NEXT or LOOP statement)
KEY$=KEY(LUN,EXCPCONTINUE) ! Exception to the next line after the next NEXT or LOOP statement)

Commands like this help keep code cleaner with fewer labels.

All of these ideas are nothing groundbreaking. And I don’t want to approach the fine line between IB commands and conventional programming. I suggest these ideas based on 2 criteria: 1. It would make programming easier or shorter. 2. They are things that I find myself doing a lot. Either alone is not necessarily enough to suggest some changes. But together, I wonder if it would be helpful. Any feedback would truly be appreciated.

I’m attaching a PDF copy of these suggestions if it’s easier for you to read.



Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

What is the name of the main Signature System's Product?  

Comments:

Optional Link URL:
Link Title:
Optional Image URL:

You may attach up to 5 files to your followup (see below):





Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.


[ Follow Ups ] [ Post Followup ] [ Signature.net Forum ]