Author Archive

Delete Duplicate Records in File Before you Assign Keys using SQL

Let’s say you are building a file from multiple spreadsheets and need to consolidate and remove duplicates.  Build your DB2 file without keys load all the spread sheets with *add not *replace then run this SQL using the where statement to match the fields

Delete from ksfcexg F1 where RRN(f1) > (select MIN(RRN(F2)) from

ksfcexg F2 where F2.stcuno = F1.stcuno)

F1 and F2 are the same file

Using .CSV files on iseries / as400 DB2

In order to convert a .CSV file in the IFS to an AS/400 (DB2) use the ‘Copy from Import File’ command:

 

CPYFRMIMPF     FROMSTMF(’Full path and file name with extension’)

Note:    You may need to use WRKLNK (Work with object Link) command to find the path filename and extension.

                                                TOFILE(Library/Filename)     

Note:     *LIBL is assumed by the system.

                                                MBROPT(*REPLACE)                                 

Note:     Valid values *ADD  *REPLACE  *UPDADD

                                                RCDDLM(*CRLF)                    

Note:     Carriage Return Line Feed works for .CSV files. There are other possible values.              

                                                FROMRCD(2)                                       

Note:     This parameter allows you to bypass headers. It may be set to any number.

                                                RPLNULLVAL(*FLDDFT)                             

Note:    This parameter allows you to replace null values with field default values. It should always be used when converting .CSV into DB2 files.

 

In order to convert an AS/400 (DB2) to a .CSV file in the IFS use the ‘Copy to Import File’ command:

 

CPYTOIMPF        FROMFILE(Library/Filename)     

Note:     *LIBL is assumed by the system.                         

TOSTMF(’Full path and file name with extension’)

Note:     You may need to use WRKLNK (Work with object Link) command to find the path filename and extension.

MBROPT(*ADD)

Note:     Valid values       *ADD  *REPLACE

RCDDLM(*CRLF)

Note:     Carriage Return Line Feed works for .CSV files. There are other possible values.

DTAFMT(*DLM)

Note:    Because we intend to separate each field with a ‘;’ this parameter setting is required. There are other possible values.

STRDLM(*NONE)

RMVBLANK(*TRAILING)

Note:     To prevent transfer of non-significant blanks.

FLDDLM(’;')          

Note:    This the delimiter to ‘;’ rather than the default :,: this was a requirement from K + S for SAP data transfers.

LANSA Green Screen Print I/O Errors Subroutine

SUBROUTINE NAME(PRT_ERROR)

DEFINE     FIELD(#ERRTXT) TYPE(*CHAR) LENGTH(100) LABEL(’Error :’)

DEFINE     FIELD(#RETCODE) TYPE(*CHAR) LENGTH(2)

DEF_LINE   NAME(#ERROR) FIELDS((#ERRTXT)) IDENTIFY(*LABEL)

USE        BUILTIN(GET_MESSAGE) TO_GET(#RETCODE #ERRTXT)

DOWHILE    COND(’#RETCODE *EQ OK’)

PRINT      LINE(#ERROR)

USE        BUILTIN(GET_MESSAGE) TO_GET(#RETCODE #ERRTXT)

ENDWHILE

ENDROUTINE

Template Special Variables

 


Application templates may contain special variables. Special variables are predefined template variables whose values are assigned by LANSA or by template commands. These variables are used by template commands and can be substituted into RDML when the template executes. In this respect, special variables are similar to a LANSA system variable where the value of the variable is set by executing a program (a template command).

Special variables are used in both application templates commands and RDML commands. For example:

@@QUESTION PROMPT(’Actual test condition…’)

ANSWER(@@CANS002) HELPIDS(HELP010)

IF COND(’@@CANS002′)

ENDIF

The user is requested to enter a description of the test condition to be used in an RDML command. The user’s reply is stored in a special variable @@CANS002. The value of @@CANS002 will be substituted into the RDML IF command.

There are four basic groups of special variables:

·         general variables

·         question and answer variables

·         file variables

·         list variables.

Special variables play a very important role in templates as they provide a means of accessing and manipulating information from the template commands.

LANSA Template Commands

The LANSA template language is a simple “tag” language that relies on branch type logic. It is not a sophisticated programming language. All commands conform to the normal LANSA command conventions. For instance, positional or keyword parameter specification can be used, lists must be enclosed in brackets, etc. The template language is not compiled. It is an interpretive language.

Note: In the lists below, ‘*’ indicates user input requested.

List Commands

@@CLR_LST

Clear/define a work list

@@MAK_LSTS

Make a list of selected fields from another list(s)*

@@MRG_LSTS

Merge a list(s) with another list(s)

File Commands

@@GET_FILS

Get the files to be used in this template*

@@RTV_FLDS

Retrieve the fields in a file

@@RTV_KEYS

Retrieve the keys of a file

@@RTV_RELN

Retrieve the relationship between two files

Control Command

@@GOTO

Pass control to a label

@@IF

Test a condition and pass control to a label

@@LABEL

A label which is the subject of another command

@@CMP_IDX

Compare an index value

@@DEC_IDX

Decrement an index value

@@INC_IDX

Increment an index value

@@SET_IDX

Set an index value

Other Commands

@@COMMENT

Add a comment line to the generated RDML code

@@QUESTION

Ask a question and receive a reply*

 

reven8e

abc tv pilot reven8e

Dead Sea Minerals Skin Care from 3in1Skincare.com

Dead Sea Minerals Lotion
Dead Sea Minerals Lotion

These 3in1 Dead Sea skin care products provide a total solution that retards the aging process. It prevents dry skin, winter skin, and other skin problems, and even reduces or eliminates the symptoms and discomfort of serious skin diseases llike dermatitis, psoriasis, and eczema.

The anti-bacterial, deep cleaning Hand Soap is unscented and hypoallergenic. Use it as often as you like. It has a high pH factor of 5.5, which makes it non-irritating.

The Hand Lotion soothes and replenishes essential oils and vitamins. It leaves your hands clean and without any scent or residue. Use it after washing hands with Hand Soap.

The 3in1 Body Lotion enters the pores of your skin and immediately banishes dryness. It makes your skin soft, youthful, and healthy.

The Foot Balm makes your feet feel good again. The Dead Sea minerals, vitamins, and essential oils prevent dryness, cracking skin, and calluses. The skin on your feet becomes smooth and rejuvenated. Your feet feel invigorated due to the improved blood circulation.

The Shower Gel makes your shower a pleasurable, sensual experience. It’s scented with natural citrus oil to enhance the experience. Dead Sea minerals, vitamins, and essential oils replenish the skin. Hypoallergenic and non-irritating.

Dead Sea Skin Care from 3in1Skincare.com

Working to get 3in1 Skin Care back in the game. Website was neglected. Adding seo and campaigning on twitter. Any other ideas?

3in1 Skincare remedies for problem skin, eczema, psoriasis and dermatitis, with Dead Sea minerals that rejuvenate and heal skin

3in1 Skincare remedies for problem skin, eczema, psoriasis and dermatitis, with Dead Sea minerals that rejuvenate skin.

Facebook API Stuff


BASH SHELL VI COMMANDS


Inserting Text


i Insert before cursor
I Insert before line
a Append after cursor
A Append after line
o Open a new line after current line
O Open a new line before current line
r Replace one character
R Replace many characters


Motion


h Move left
j Move down
k Move up
l Move right
w Move to next word
W Move to next blank delimited word
b Move to the beginning of the word
B Move to the beginning of blank delimted word
e Move to the end of the word
E Move to the end of Blank delimited word
( Move a sentence back
) Move a sentence forward
{ Move a paragraph back
} Move a paragraph forward
0 Move to the begining of the line
$ Move to the end of the line
1G Move to the first line of the file
G Move to the last line of the file
nG Move to nth line of the file
:n Move to nth line of the file
fc Move forward to c
Fc Move back to c
H Move to top of screen
M Move to middle of screen
L Move to botton of screen
% Move to associated ( ), { }, [ ]


Deleting Text


Almost all deletion commands are performed by typing d followed by a motion. For example, dw deletes a word. A few other deletes are:
x Delete character to the right of cursor
X Delete character to the left of cursor
D Delete to the end of the line
dd Delete current line
:d Delete current line


Yanking Text


Like deletion, almost all yank commands are performed by typing y followed by a motion. For example, y$ yanks to the end of the line. Two other yank commands are:
yy Yank the current line
:y Yank the current line


Changing text


The change command is a deletion command that leaves the editor in insert mode. It is performed by typing c followed by a motion. For wxample cw changes a word. A few other change commands are:
C Change to the end of the line
cc Change the whole line


Putting text


p Put after the position or after the line
P Put before the poition or before the line


Buffers


Named buffers may be specified before any deletion, change, yank or put command. The general prefix has the form “c where c is any lowercase character. for example, “adw deletes a word into buffer a. It may thereafter be put back into text with an appropriate “ap.


Markers


Named markers may be set on any line in a file. Any lower case letter may be a marker name. Markers may also be used as limits for ranges.
mc Set marker c on this line
`c Go to beginning of marker c line.
c Go to first non-blank character of marker c line.


Search for strings


/string Search forward for string
?string Search back for string
n Search for next instance of string
N Search for previous instance of string


Replace


The search and replace function is accomplished with the :s command. It is commonly used in combination with ranges or the :g command (below).
:s/pattern/string/flags Replace pattern with string according to flags.
g Flag - Replace all occurences of pattern
c Flag - Confirm replaces.
& Repeat last :s command


Regular Expressions


. (dot) Any single character except newline
* zero or more occurances of any character
[…] Any single character specified in the set
[^…] Any single character not specified in the set
^ Anchor - beginning of the line
$ Anchor - end of line
\< Anchor - begining of word
\> Anchor - end of word
\(…\) Grouping - usually used to group conditions
\n Contents of nth grouping
[A-Z] The SET from Capital A to Capital Z
[a-z] The SET from lowercase a to lowercase z
[0-9] The SET from 0 to 9 (All numerals)
[./=+] The SET containing . (dot), / (slash), =, and +
[-A-F] The SET from Capital A to Capital F and the dash (dashes must be specified first)
[0-9 A-Z] The SET containing all capital letters and digits and a space
[A-Z][a-zA-Z] In the first position, the SET from Capital A to Capital ZIn the second character position, the SET containing all letters
/Hello/ Matches if the line contains the value Hello
/^TEST$/ Matches if the line contains TEST by itself
/^[a-zA-Z]/ Matches if the line starts with any letter
/^[a-z].*/ Matches if the first character of the line is a-z and there is at least one more of any character following it
/2134$/ Matches if line ends with 2134
/\(21|35\)/ Matches is the line contains 21 or 35Note the use of ( ) with the pipe symbol to specify the ‘or’ condition
/[0-9]*/ Matches if there are zero or more numbers in the line
/^[^#]/ Matches if the first character is not a # in the line
Notes:1. Regular expressions are case sensitive2. Regular expressions are to be used where pattern is specified


Counts


Nearly every command may be preceded by a number that specifies how many times it is to be performed. For example, 5dw will delete 5 words and 3fe will move the cursor forward to the 3rd occurence of the letter e. Even insertions may be repeated conveniently with thismethod, say to insert the same line 100 times.


Ranges


Ranges may precede most “colon” commands and cause them to be executed on a line or lines. For example :3,7d would delete lines 3-7. Ranges are commonly combined with the :s command to perform a replacement on several lines, as with :.,$s/pattern/string/g to make a replacement from the current line to the end of the file.
:n,m Range - Lines n-m
:. Range - Current line
:$ Range - Last line
:’c Range - Marker c
:% Range - All lines in file
:g/pattern/ Range - All lines that contain pattern


Files


:w file Write to file
:r file Read file in after line
:n Go to next file
:p Go to previos file
:e file Edit file
!!program Replace line with output from program


Other


~ Toggle upp and lower case
J Join lines
. Repeat last text-changing command
u Undo last change
U Undo all changes to line