Blogs

What does IT Consultant really mean?

  • Posted on: 12 November 2012
  • By: NickLitten

being a computer programmer is a great job

I am not a fan of the 'IT Consultant' moniker because its kind of generic, non-descriptive and dull. Sadly, it's the industry standard so I'm stuck with it. :(

I would like to describe myself as a Programmer in the same way that a person who is a Butcher, Dentist, Mechanic or Carpenter is clearly defined. But then people think I am just a code monkey. *sigh* So, I'm back to writing 'IT Consultant' in any form that asks for job title. So I suppose in my case, being an IT Consultant means I am a software developer, IBM i evangelist, RPG language lover, Drupal enthusiast, software change management tinkerer, early adopter, proponent of open source and hopeless web addict. All of these things add up to one easy to chant mantra

"Yes, I am a Programmer and I am proud to Program - Veni, Vidi, Programmum"

My main fields of expertise are

Query Management Queries are Queer

  • Posted on: 8 November 2012
  • By: NickLitten

So, I was emailed the following hints and tips document discussing the ubiquitous Query Management Qeuery object type on the IBM Power Server (the artist formerly known as AS400). It's useful to refer to so, here it is:

QMQRY - QUery Management Query

A SOURCE FILE FOR YOUR QUERY

The key to making a query dynamic is converting it into a form that can accept variables. The easiest way to do that is to convert your query to a Query Management Query (QMQRY). A QMQRY is simply an SQL statement stored in a source member. Once the SQL statement has been placed into a source member, you can replace hard-coded values from your original query with variables that can be replaced at execution time. If you've never worked with SQL before, you needn't worry; we will make use of an IBM command that will construct SQL statements for you.

We'll begin by creating the source file used to store your QMQRYs: QQMQRYSRC. To create this source file, use command Create Source Physical File:

CRTSRCPF  FILE(library/QQMQRYSRC) RCDLEN(91)

Be sure to specify a record length of 91 (source length of 79, sequence number length of 6, date length of 6) instead of the command default of 92, as QMQRY requires a length of no more than 79 bytes for the source statement. If you specify a length of more than 91 on the CRTSRCPF command, you will not be able to run your SQL statements.

 

Boris the LR3 gets a new crank sensor

  • Posted on: 1 November 2012
  • By: NickLitten
This is not the cursed LR3 this is my most excellent Defender

Courtesy of the very nice chaps at Kensington Motor Cars here in Las Vegas - http://www.kmcnv.com

landorver lr3 crank sensor jobbie

A new engine crank sensor!

Now... this might seem like a tiny little bit of plastic and metal but is it the savior or haunted LR3 engines everywhere?

After many, many, many discussions with the garage owner (Bill) and Customer Service girlie (Trish) we decided this was the next angle of attack. Apparently this little gadget looks at the engine and decides to tell the starter motor wheter it should start - or crank as these Yanks call it - and if its a little bit whoozy or drunk then maybe it wont tell the engine computer its started. Or maybe it will tell it that its started - even when it hasnt. AHA! This could be it. I'm excited.

And guess what... changing the crank sensor seems to have fixed it!

It's now been three weeks and still going strong. Boris has starteda every time.

It's a miracle.

So much for the famous Exorcist quote - I've revised it to "The power of the crank sensor compels thee"

 

Camp Bow Wow Las Vegas - Pet Hotel with a difference

  • Posted on: 30 October 2012
  • By: NickLitten

My hound, Bailey Version Two, is staying with the wonderful chaps at Camp Bow Wow Las Vegas this week.  I'm Hurricane dodging on the East Coast, and didnt want to risk flying him over here with all the potential air travel problems. So, he's shacked up for ten days with his buddies at Camp. I did laugh this morning, when I discovered that Bailey had taken time from his busy canine-play schedule to email me:

 
"HI DAD!
How are you?? I am just fine at Camp. I miss you soo much but dont you worry about me.. I am keeping nice and busy with all of my pals and the counselors, too! Here are a couple cute pictures of me for you to enjoy while we're apart. Hope you like them! Miss and love you lots and cant wait to see you ! XOX
Furry Regards,
BAILEY". 
 
Bailey the Springer Spaniel
Love those Camp Bow Wow folks... its the little things like this that make them my preFURd pet people in Vegas   :)

using %REPLACE to Scan Replace in RPG4

  • Posted on: 25 October 2012
  • By: NickLitten

So, I want to do a SCAN and REPLACE in RPG - What's the easiest way?

Using the %REPLACE built in Function is easy and efficient allthough code wise its a little cumbersome:

// Update email address                                  
Dow %Scan('L#EMAIL': %TRIMR(SrcDta )) > *Zeros;          
    SrcDta  = %Replace(%trimr(ParmEmail) 
              :SrcDta 
              :%Scan('L#EMAIL' : %TRIMR(SrcDta ))
              :7);    
EndDo;                                                   

In this example, I am scanning a program variable (SRCDTA) looking for any occurence  of the word "L#EMAIL" and replacing it with the contents of "PARMEMAIL". The email value is %TRIM'ed which means that any blanks at the end of the email address are ignored.

I use a similar process in the PROJEX Service Program and then you can easily run a SCAN/REPLACE on a single line of RPG code.

So lets say I wanted to scan for the word 'bob' and change it for the word 'Fred' within a string i could do it like this using this Prototype:

 = #Scanreplace (  : 'bob' : 'Fred' )

Much simpler than using the complex %REPLACE BIF I'm sure you will agree. 

Here's the Prototype:

CL Outfiles are like totally last year, Dude!

  • Posted on: 17 October 2012
  • By: NickLitten

Using the internal cross reference files mean that us lowly IBMi Programmers can access heap of system information just by reading a file... the days of DSPFFD to an outfile then reading the outfile are long gone - we can just read the file field information direct from QADBIFLD instead...

There are eight cross-reference physical files, each containing a different type of information.

How do I right adjust a numeric into an alpha field using RPG4?

  • Posted on: 15 October 2012
  • By: NickLitten

I have a NUMERIC in an RPG program that I want to move RIGHT into an Alpha field. In the old days of RPG3 I would use MOVE but in the new days of RPG4 I have a couple of more flexible solutions.  So, lets say we have a numeric field containing the number 1234, defined as an signed numeric 10 long it would be stored as - 0000000123. And a Result field which is a big long alpha field:

d          s             10s 0 inz(1234)

d           s             10a   inz(*BLANKS)

Some programmers will forget that = else is actually eval  = because the eval is silent  :)
 
We have two easy ways of transforming using RPG4:

With Zero Suppression

If we want to be  tranformed right justified  as  '          1234'' then:

Eval(r) ResultVariable = %char();

Note that the %CHAR %BIF will zero suppress the front of any numeric value.

Without Zero Suppression

If we want to be  right justified  and show the entire number  '0000001234'' then:

Droid Razr HD - Coming to Verizon Oct 18th?

  • Posted on: 10 October 2012
  • By: NickLitten

I've rarely been as excited to get my hands on a new phone as I have been since the announcement of the Motorola Droid Razr HD model.

According to Droid-Life, whispering points to Motorola and Verizon targeting October 18th as a release date for both the Droid RAZR HD and the Droid RAZR MAXX HD.

...the RAZR HD and RAZR MAXX HD both tout a 4.7-inch 720p Super AMOLED HD display and 1.3-megapixel camera on their faces, as well as an 8-megapixel shooter around back. The two phones also feature 1.5GHz dual-core processors, 1GB RAM, Verizon 4G LTE connectivity, Motorola's Smart Actions software and Android 4.0.4 Ice Cream Sandwich, with an upgrade to Android 4.1 Jelly Bean coming before the end of 2012. The differences between the two phones involve battery size and storage. The RAZR HD features 16GB of memory while the RAZR MAXX HD packs 32GB of storage space (both have microSD slots), and the RAZR HD has a 2,530mAh battery while the RAZR MAXX HD's battery is 3,300mAh...

Doing Loop the Loops in RPG3 and RPG /Free

  • Posted on: 10 October 2012
  • By: NickLitten

So, whenever possible, if I'm editing some old RPG3 or RPG400 code I spend a coffee* cleaning the code up to a more readable form:

  • Use CVTRPGSRC if its old RPG3 stuff
  • Change '1' to *ON
  • Change '0' to *OFF
  • Change Z-ADD to EVAL
  • Insert comments where applicable
  • put some spaces between subroutines and blocks of functionally similar code
  • Then its into WDSC7 and convert to /FREE

Websphere is old technology but I'm not going to spend over $800 on IBM's Rational Developer for i version... c'mon IBM come up with a sensible price for a source code editor. Obviously, the most sensible is FREE.

DO LOOPS are something that sometimes make me scratch my head when uplifting to RPG4. So just for my reference here is an example of the exact same code in RPG3, RPG400 and RPG4 (or RPG ILE as its sometimes called).

 

RPG3

             DO        SAVRRN        X
             MOVE      PLOP          THING
X            IFGT      10
FIELD1       CAT       FIELD2        RESULT      
             END
             END

 

RPG400

Whats better - Hard work, Knowledge or Attitude?

  • Posted on: 10 October 2012
  • By: NickLitten

Here is a little something a friend sent me that is indisputable mathematical logic. Nerdish and silly but I suppose it appeals to the dark mathematical side of my soul. But the message is very true.

It goes like this:

What Makes 100%? What does it mean to give MORE than 100%? Ever wonder about those people who say they are giving more than 100%? We have all been to those meetings where someone wants you to give over 100%. How about achieving 103%? What makes up 100% in life?

Here's a little mathematical formula that might help you answer these questions:

If: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z is represented as: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

Then:

H-A-R-D-W-O-R-K = 8+1+18+4+23+15+18+11 = 98%

and

K-N-O-W-L-E-D-G- E = 11+14+15+23+12+5+4+7+5 = 96%

But ,

A-T-T-I-T-U-D-E = 1+20+20+9+20+21+4+5 = 100%

So, inversely this means

Pages