What I'm Thinking

DB2 supports ranking and numbering in much the same way that Oracle does. The available functions are: ROW_NUMBER(), which simply numbers the returned rows sequentially </li> RANK(), which ranks the results, but, in the case of a tie, gives the same number to each and leaves a gap to compensate </li> DENSE_RANK() operates the same as RANK() but doesn’t leave any gaps. Listing 1 - Ranking and Numbering Results ... Read More
DB2’s method of performing a Top-N query is the FETCH FIRST clause. You can append these variations to a regular SELECT query: FETCH FIRST ROW ONLY FETCH FIRST 1 ROW ONLY FETCH FIRST integer ROWS ONLY Interestingly, you can also use: FETCH FIRST 1 ROWS ONLY FETCH FIRST 5 ROW ONLY They aren’t as nice grammatically, but they make it easier to generate queries automatically - you don’t have to worry about whether to say ROW or ROWS. ... Read More

INSPECT in COBOL
23 January 2012

The INSPECT verb has two options, TALLYING and REPLACING. You can do one or the other or both. If both are done, the TALLYING IS DONE BEFORE THE replacing. Some versions of the INSPECT require that all the literals be in quotes. This may call for a redefination if the field is numeric. In using the TALLYING format of the INSPECT, you are tallying into a field that is a counter. ... Read More
The following common COBOL data types are discussed below: Binary Computational (comp) Comp-1 Comp-2 Comp-3 Packed Decimal **BINARY ** Specified for binary data items. Such items have a decimal equivalent consisting of the decimal digits 0 through 9, plus a sign. Negative numbers are represented as the two’s complement of the positive number with the same absolute value. The amount of storage occupied by a binary item depends on the number of decimal digits defined in its PICTURE clause: ... Read More

ISPF Special Searching
23 January 2012

A picture string in a FIND, CHANGE, or EXCLUDE command allows you to search for a particular kind of character without regard for the specific character involved. You can use special characters within the picture string to represent the kind of character to be found, as follows: They can be used in REXX ISREDIT macros too. String Meaning P’=’ Any character P’¬‘ Any character that is not a blank P’. ... Read More