Thursday, September 29, 2011

Object conversion issues...

The ANZOBJCNV report identified 3 objects in QGPL that can not be converted to 6.1. They look like IBM programs, QDCUPF, QRZHWUG1 and QRZHWUG2. After doing some research it seems that the objects are left over from a previous cisc to risc conversion. Based on that information I am deleting the programs.

Richard

Finished looking for damaged objects...

That was a good refresher. I finished running and analyzing RTVDSKINF. I found some more good information on the types of reports that could be run using the RTVDSKINF at IT Jungle. Even though I have access to a custom written library summary tool I found working with the RTVDSKINF reports just as easy and if need I could always SQL the data to retrieve specifics.

Just to be through I also ran the following:
To be able to see if any objects are damaged, run this:
SBMJOB CMD(DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE)
OUTFILE(QGPL/DSPOBJD)) JOB(DSPOBJD) JOBQ(QTXTSRCH)

Then in SQL (STRSQL or WRKDBF or iSeries Navigator, Databases,
right-click Run SQL Scripts) after the above job has finished, do this:
SELECT * FROM QGPL/DSPOBJD WHERE ODOBDM <> '0'


This will also show damaged objects.

After reading pretty much everything on the subject I basically come to the conclusion that the only way I am going to know for sure is by running a system save.

Richard

Looking for damaged objects

Currently looking for damaged objects using RTVDSKINF. The command ran fine but no objects are showing as damaged and I do believe the last system save reported a couple of damaged objects. Unfortunately they were not critical and at the time had bigger issues, I did not write down the names.

I am now running -
DSPOBJD OBJ(*ALL/*ALL) OBJTYPE(*ALL) DETAIL(*FULL) OUTPUT(*OUTFILE)
OUTFILE(LIBRARY/OUTPUT_FILE)

I am getting good information from http://www.itjungle.com/fhg/fhg092111-story03.html

Richard

Monday, September 26, 2011

New Power 7 on order

Good start for a Monday, NanjingUSA has placed the order for a new 720 Power 7 iSeries. I will be doing the conversion from the current 520 at OS V5R4. This will keep me busy for the next couple of weeks.

Richard :)

Saturday, September 24, 2011

Embedding SNDMAIL in RPGLE program

Over the last couple of days I have been enhancing the EDI 816 Organization document automation for NanjingUSA. Last week I added an enhancement to process the Wal-Mart document by Global Location Number and send E-mail with the update statistics.


The Organizational Relationships (EDI 816) document is used to communicate location address and relationship information. On the most frequently exchanged EDI documents (the PO, ASN, and invoice) locations are most often identified only by codes in order to avoid the cost of transmitting full addresses. Location codes are unique to a specific trading partner. The 816 document tells trading partners the address to associate with a particular location code. The trading partner receiving the 816 can use it to maintain a list of the sender's location codes and associated addresses. An alternate format of the 816 is used to show organizational relationships, such as stores serviced by a specific Distribution Center or warehouse. Trading of 816's begins with a full set of the trading partner's addresses, after which changes may be sent on a weekly or monthly basis, or as needed.


My new challenge is due to the capability of receiving different GLN number for the same store. This is a normal situation as the first record received has a delete code and the second record is the add to replace the previous recorded deleted. The VAI ship to master file is uniquely keyed by company, customer # and ship to #. The deficiency here is that VAI does not have the record status as part of the unique key. This file is way to integrated to change the physical file key at this point. With this scenario the program will halt with a duplicate record key when the record is written to the file.


If NanjingUSA was a bigger operation and I had access to Hawkeye cross reference I would change the DDS and add the status field to the unique key. But for now I will just code around the deficiency.


So now it is time to look into the new MONITOR operation code that I have never used before. I want to be able to avoid the program halting and waiting for someone to answer the program error message. The EDI 816 process is automated thru the job scheduler .


I also want to be able to call the VAI SNDMAIL program from the RPGLE to send E-mail with the failing store and GLN numbers. I could have created a couple of parameters and pass parameters back to the calling CL program to send the E-mail but I wanted to also practice with Prototypes and QCMDEXEC.


*==================================================*/

* Add shipvia record */

*==================================================*/

C Addrec BEGSR

/Free

monitor;

/End-free

*

C kshp CHAIN varshp2

C IF NOT %FOUND

*

C ….Populate fields …..

* Determine is store or DC

*

* …End populate fields

*

C write arshipr

C eval recadd = recadd + 1

C else

C exsr Chgrec found then chg

C endif

C

/Free

on-error;

getsmtp (userid:system:emaddr);

@RecipFull = %trim(userid) + ' ' + %trim(emaddr);

@msg = 'Possible duplicate store, check EDI816H2 +

errors. Store ' + BHDSNB + ' and GLN ' +

BHGLN + '.';

exsr errormsg;

Cmd_Str = 'sndmail recipient((' + %trim(@Recipfull) + ')) +

sender(' + %trim(@SendFull) + ') +

subject(Error_in_EDI816) +

msgm(R37NAN/QHTMLSRC/ERRORMSG)';

ExcCmd (Cmd_Str: %len(Cmd_Str));

recerr = recerr + 1;

$pos2 = 1;

endmon;

/End-free

*

C endsr


The real trick here is creating the command string and overcoming the short comings of the SNDMAIL program. The Subject and Message will not accept variables. So I added a new member to the QHTMLSRC source file and added some embedded SQL to a subroutine to update the file with the error information. This enables me to send a HTML message using the SNDMAIL.


*----------------------------------------------------------------

* Change file path in source file to send in E-mail

*----------------------------------------------------------------

/free

begsr errormsg;

/end-free

C*

C/exec sql

C+ Create alias qtemp/errormsg for r37nan/qhtmlsrc(errormsg)

C/end-exec

C*

C/exec sql

C+ update qtemp/errormsg

C+ set srcdta = :@msg

C+ where RRN(errormsg)=2

C/end-exec

C*

C/exec sql

C+ Drop alias qtemp/errormsg

C/end-exec

C*

/free

endsr;

/end-free


One thing that I should change is hardcoding the library. I also could monitor for the exact error for duplicate key message but it is adequate to just capture any error when writing the new record. Also if the record is in error the input record status code is change to 'X' and logical file has select of status of blank or 'X'. This file quickly identifies records not processed and / or in error.


All in all this is really cool stuff, they really made coding for program and file errors very easy. You may also notice that there is a mix of free and legacy code, I wrote this program four years ago and currently there is no need the rewrite the program.


Richard

Wednesday, September 21, 2011

PO cuts project...

It's hard to believe that it's been ten days since my last post. I have been really busy polishing up my RPGLE Free and SQL skills. Thank fully I am able to do this while making some money to pay the bills.


I finely reverse engineered VAI's S2K send mail program. Many thanks to Scott Kelment and his published article on QtmmSendMail API. I now know the nuts and bolts of sending HTML mail from the iSeries. I always knew the capability was there just never had the time to figure it out. At this point I can embed SNDMAIL in any custom program to send HTML in the body of an Email message using a source physical file member.


While I was looking a Scott's QtmmSendMail information I discovered he published the complete code to retrieve SMTP address from the IBM directory entries by user name. This was another great example of using IBM API's. I guess my only fear is that IBM would change a API on subsequent releases. I hope this does not come back to haunt me but I truly believe in using what is available rather than reinventing the wheel.


I also showed Jason Vickery Surveyor/400 from Linoma software. This software came up in conversation regarding the future upgrade of the iSeries hardware and software for NanjingUSA and a replacement for WRKDBF. WRKDBF is a great product for free (as it was for years) and priced at $449.00 is still ok but for $1000.00 Surveyor/400 was a no brainer. I downloaded / installed the product, and Jason was thrilled. He now had a windows based software with a ton of features such as:

* View and convert spooled files to a PDF or TXT format

* View, add, change and delete database records using a spreadsheet-like interface

* Download files to your workstation or to the IFS into delimited, fixed, XML or HTML files

* Upload text files into iSeries database files (MUCH easier and faster than Client Access)

* FTP objects between iSeries

* Create, run and save SQL statements

* Run 5250 screens with a built-in emulator

* Automate data transfers from the PC or System i

* Display and change data areas


Surveyor/400 has a neat feature that allows you to export files to the IFS in Excel format. The command EXPDTA can be embedded in a CL. I could have just modified and used code publicly available to create my own custom command but since we now have Surveyor/400 I decided to use their command instead.


In reading the EXPDTA documentation I discovered that Surveyor/400 required Java 1.5 on the Iseries. I only had 1.4 installed. I loaded the IBM licensed program from CD and reapplied the latest Java PTF group. It's kind of neat to do all this remotely. Jason inserted the CD and I completed the rest of the process myself.


So armed with all this wonderful information I completed client request to enhance a program. A few years back I designed, and retained Rick Santiago to write, a custom backorder program based on orders in VAI S2K for Wal-Mart. Orders from Wal-Mart come in different flavors such as ship to store, ship to Wal-mart.Com warehouse, ship to warehouse and DSDC (ship to DC mark for store). The DSDC orders are a little challenging in the fact that many orders are created for a single PO. Users run the program by selecting customer (built for future enhancement), invoice date from and invoice date thru. The data is output to a file that is manually transferred from the iSeries and imported into Excel. Once in Excel the headings are changed and then the spreadsheet is emailed.


At the time Wal-Mart was ship complete or cancel order customer. I was also getting ready to take a new position and relocate to Jacksonville. I was a little short on time so the process was not very pretty but functional.


The new requirement is to add the original order quantity to the spreadsheet and since I was working on the program, automate the process as much as possible.


I delivered the completed programming Monday and works great. The user enters Customer, Invoice date from and Invoice date thru and a few minutes later receives an E-mail with a link to the file on a network share. The Heading is 14 and bold and the column names are 12, bold and underlined.


I accomplished all the goals and then some. The link in the Email was the cherry on top. It just tickles me that I know longer have to send files attached in Email and that I was able to automate the whole process.


Richard


Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more, and more expensive clerks even though they call them "operators" or "programmers." ~Peter F. Drucker

Sunday, September 11, 2011

Another good week...

Had another good week. Even though I am currently unemployed I continue to have remote programming work and positive feedback from my peers.

Accomplished getting WSDC 6.0 communicating with clients iSeries. Had issues with needing the ports on the firewall opened. What a pleasure to be able to read, change and debug with WSDC GUI. Thanks Sam for showing me the light!

Finished adjusting and enhancing clients automated EDI 816 organization documents from Wal-Mart. I originally created the program a few years back but the program was lacking the capability to identify Wal-Mart DC's to create the correct ship to identification in VAI System 2000.
To accomplish the task I incorporated some new technics using RPGLE FREE and Embedded SQL.
First I used %SCAN bif to locate position and character of the warehouse type alpha identification in the name description in the incoming EDI document for warehouse adds, changes or deletes.
Next, used %SUBSTR to extract the full warehouse identification.
Next, used %CHECK to make sure I have a character or send error notification if not.
Next, used %XLATE to change the alpha character to cross referenced number.
I also used VAI's SNDMAIL to send email reporting how many add, changes and deletes as well as total incoming and processed records. This involved adding counters and passing a text parameter back to the calling CL and initiating SNDMAIL command.
This task was a good exercise of programming skills I picked up over the last few years and unable to use regularly due to managing and user support responsibilities.

Also installed Linoma's Surveyor/400 on clients iSeries. I picked up Surveyor from previous coworker and found that is inexpensive enough to sell to the smaller clients. I look forward to showing Jason how to use the software to replace WRKDBF and SQL green screen. I have a really good project for this week and Surveyor will come in handy.

Richard

Wednesday, September 7, 2011