Nagios Log Monitoring – Monitor Log Files in Unix Effectively

[ad_1]

Nagios Log File Monitoring: Monitoring log files using Nagios can be just as difficult as it is with any other monitoring application. However, with Nagios, once you have a log monitoring script or tool that can monitor a specific log file the way you want it monitored, Nagios can be relied upon to handle the rest. This type of versatility is what makes Nagios one of the most popular and user friendly monitoring application that there is out there. It can be used to effectively monitor anything. Personally, I love it. It has no equal!

My name is Jacob Bowman and I work as a Nagios Monitoring specialist. I've come to realize, given the number of requests I receive at my job to monitor log files, that log file monitoring is a big deal. IT departments have the ongoing need to monitor their UNIX log files in order to ensure that application or system issues can be caught in time. When issues are known about, unplanned outages can be avoided altogether.

But the common question often asked by many is, what monitoring application is available that can effectively monitor a log file? The plain answer to this question is NONE! The log monitoring applications that does exist require way too much configuration, which in effect renders them not worthy of consideration.

Log monitoring should allow for pluggable arguments on the command line (instead of in separate config files) and should be very easy for the average UNIX user to understand and use. Most log monitoring tools are not like this. They are often complex and require time to get familiar with (through reading endless pages of installation setups). In my opinion, this is unnecessary trouble that can and should be avoided.

Again, I strongly believe, in order to be efficient, one must be able to run a program directly from the command line without needing to go elsewhere to edit config files.

So the best solution, in most cases, is to either write a log monitoring tool for your particular needs or download a log monitoring program that has already been written for your type of UNIX environment.

Once you have that log monitoring tool, you can give it to Nagios to run at any time, and Nagios will schedule it to be kicked off at regular intervals. If after running it at the set intervals, Nagios finds the issues / patterns / strings that you tell it to watch for, it will alert and send out notifications to whoever you want them sent to.

But then you wonder, what type of log monitoring tool should you write or download for your environment?

The log monitoring program that you should obtain to monitor your production log files must be as simple as the below but must still remain powerfully versatile:

Example: logrobot / var / log / messages 60 'error' 'panic' 5 10 -foundn

Output: 2 — 1380 — 352 — ATWF — (Mar / 1) – (16:15) — (Mar / 1) – (17:15:00)

Explanation:

The "-foundn" option searches the / var / log / messages for the strings "error" and "panic". Once it finds it, it'll either abort with an 0 (for OK), 1 (for WARNING) or 2 (for CRITICAL). Each time you run that command, it'll provide a one line statistic report similar to that in the above Output. The fields are delimited by the "—".

1st field is 2 = which means, this is critical.

2nd field is 1380 = number of seconds since the strings you specified last occurred in the log.

3rd field is 352 = there were 352 occurrences of the string "error" and "panic" found in the log within the last 60 minutes.

4th field is ATWF = Do not worry about this for now. Irrelevant.

5th and 6th field means = The log file was searched from (Mar / 1) – (16:15) to (Mar / 1) – (17:15:00). And from the data gathered from that timeframe, 352 occurrences of "error" and "panic" were found.

If you would actually like to see all 352 occurrences, you can run the below command and pass the "-show" option to the logrobot tool. This will output to the screen all matching lines in the log that contain the strings you specified and that were written to the log within the last 60 minutes.

Example: logrobot / var / log / messages 60 'error' 'panic' 5 10 -show

The "-show" command will output to the screen all the lines it finds in the log file that contains the "error" and "panic" strings within the past 60 minute time frame you specified. Of course, you can always change the parameters to fit your particular needs.

With this Nagios Log Monitoring tool (logrobot), you can perform the magic that the big name famous monitoring applications can not come close to performing.

Once you write or download a log monitoring script or tool like the one above, you can have Nagios or CRON run it on a regular basis which will in turn enable you to keep a bird's eye view on all the logged activities of your important servers.

Do you have to use Nagios to run it on a regular basis? Absolutely not. You can use whatever you want.

[ad_2]

Source by Jonathan Rayson

What Is Android? How Android Came Into Existence

[ad_1]

Android is a Linux based mobile device operating system developed by the Open Handset Alliance led by Google. Android is mainly used in Smartphone and tablet computers. Android is open source ie its features can be extended to incorporate new technologies as they emerge.

Android, Inc. was founded by Andy Rubin, Rich Miner, Nick Sear and Chris White in Palo Alto, California. On August 17, 2005 Google acquired Android Inc. making it a subsidiary of Google Inc.

On November 5, 2007, the Open Handset Alliance publicly announced their first product, Android, a mobile device platform built on Linux kernel version 2.6.

Android provides a broad spectrum of applications and services to its user. Users can fully customize their mobile phones to their interests. The first Mobile phone that has used Android was the HTC Dream, release on 22 October 2008.

Here are some features of Android Operating System .

  1. Layout: The layout is mainly based on VGA, 2D graphics library and 3D graphics library based on OpenGL ES 2.0.
  2. Storage: For data storage SQLite is used .
  3. Connectivity: Android supports GSM / EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, WI-Fi, LTE, NFC and WiMAX connectivity technologies.
  4. Multi Lingual Support: It supports multiple languages ​​.
  5. Messaging: Android supports SMS and MMS including threaded text messaging and Cloud to Device Messaging (C2DM).
  6. Web Browser: It is mainly based on the open-source WebKit layout engine and Chrome's V8 JavaScript engine.
  7. Java Support: Most of the applications are written in Java but they run on Dalvik, a specialized virtual machine designed specifically for Android.
  8. Media Support: Android supports WebM, H.263 , H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, MP3, MIDI, Ogg Vorbis, FLAC, WAV, JPEG, PNG, GIF, BMP and WebP media formats.
  9. Hardware Support: It can support wide variety of hardwares including video / still cameras, touchscreens, GPS, accelerometers, gyroscopes, barometers, magnetometers, dedicated gaming controls, proximity and pressure sensors, thermometers, accelerated 2D bit blits and accelerated 3D graphics.
  10. Multitasking: Android supports multitasking.
  11. Multi-touch: It supports multi touch natively, but previously it was disabled at the kernel level. An update was released by Google which enables multi-touch natively.
  12. External Support: Now the majority of Android devices support microSD slot and can read microSD card formatted with FAT32, Ext3fs or Ext4fs file system.

There are millions of applications available for Android which can be downloaded from Google Play, formerly Android Market. The latest version that is available to phones is Android 4.0.4 Ice Cream Sandwich.

[ad_2]

Source by Mvir Singh

Certified Ethical Hacker (CEH) Certification – Is It As Cool As It Sounds?

[ad_1]

I know, many of us would love to have that title. Most of us, if not all, at some point of time wanted to learn hacking and learning it over the internet is one thing, to be recognised as one is an another.

So back in May, the CEH course was being offered by V-ITMI at Quatres-Bornes. Since I was free and on holidays after passing my HSC and waiting for university to start, I paid for the course. The total fees were Rs42, 500 including the exam fees. Apparently the courseware itself costs around rs27, 000 and it contains 4 DVDS of tools assembled over the internet, a Linux backtrack CD (Linux live CD) and some pdf notes of the other chapters that are not covered by the instructor and is not examinable. It also has 5 big books that you will need to learn before going for the exam, a mouse pad and a pen. There were no entry requirements as long as you follow the course from an EC-Council Accredited Training center. However, if you want to skip the course and go for the exam only, you will need a written proof from your company stating you have at least 2 years' experience in the security field. You will then sit for the EC0-350 paper while I did the 312-50 paper but both is the same paper and you will obtain the same title, ie, CEH.

The course:

The first day, I had the pleasure to meet my Trainer, Mr. Franklin John from India. He is a very intelligent man and the first CCIE security I have ever met. He came all the way from India specially to deliver the course at v-itmi. The course's duration is 5 consecutive days from 9AM to 5PM and it is really very quick. You can not follow everything that the trainer is saying and he has a time schedule to finish the course, so, he moves along slide to slide very quickly and mastering every type of hacking attacks (Session hijacking, DDOS, DOS, linux hacking, buffer overflows , sql injection and so on) in this small amount of time is practically impossible.You do have breaks at 3 intervals: a tea break, tea, coffee and biscuits were served, a lunch break and a tea break again in the afternoon.

Each of the students had a personal computer where you will be expected to do live demos / testing of the tools given to you in the CD. These tools are tested on a Windows Server 2000 Advance with no patches installed. Post why? Because without the patches, the windows server 2000 is very vulnerable and you can use any tools on it: most of them is going to work. I know that you are thinking, "what the heck? It is useless, who even uses windows server 2000?" Yes, I was disappointed too because the tools will not work on Windows XP and above (With all the patches / security fixes installed ). However though, you will have an idea of ​​how hacking is done and you will grasp the concept of the types of attack that is performed with live demos provided by the instructor.

5 days were quickly over and at the end; you will need to submit an online feedback of how the course was, the competency of the trainers and so on.

The exam:

Now, time for the exams. I went for the exams after a month or so because I was also preparing for my CCNA & VCP exam. The exam's cost is included in the courseware that you bought. However, if you fail the exam, the next time, you will have to bear the cost. The exam consists of 150 multiple choice questions and is 4 hours long. The MCQ questions vary. Some may have only one answer while others may have up to 3 or even 4. The questions in the exam were not entirely what I read from the book. I would say 80% of them were in the book but the remaining, some personal knowledge and logic is required. I ended the exam in 3 hours and 30 minutes and I passed! I was really happy because 1) This is my first ever certification and 2) the name is so cool.

But really, was it worth it? Rs42, 500 for something out-dated: Well, I am not so sure. I would have rather opted for ISC2 security certifications. However, CEH was a good experience in the sense that, it is the only course out there that will teach you 'hacking' with live demos. It was fun, I admit.

After a month, my welcome kit finally arrived. It consisted of one certificate, one welcome letter and one big sticker with CERTIFIED ETHICAL HACKER written on it. Also, you will have access to the official CEH logo which looks unprofessional according to me and a unique code is given to you where you will have access to a certified member's portal where CEH all around the world share ideas, discuss anything etc.

If you are thinking about doing a certification in the security field, I would recommend Security + as a start and a security certification from ISC2 later on. Details here more ( Https://www.isc2.org/credentials/ )

All the best!

[ad_2]

Source by Mozammil Khodabacchas

How To Run 16-Bit Software On A Windows 7 64-Bit Computer

[ad_1]

I live in an area of ​​the country where there are many elderly people. Many of these wonderful people still have old computers that are running old software. However, little by little they are beginning to upgrade their computers and Operating Systems to the latest and greatest 64-bit Windows 7 – but they want to keep using their beloved old software. Therein lies the problem!

The other day I set up a new Windows 7 machine for a client. He was extremely happy and then he said "OK, now let's install my wife's American Greetings CreataCard Gold 5 and my Hoyle Card Games". He and his wife had used these same programs for years and they could not live without them!

Well as you can probably imagine, these two programs would not install. Both of these older programs are16-bit and will not install on the 64-bit Windows 7 OS. If my client had purchased a computer running 32-bit Windows 7, he could have run his programs in Compatibility Mode but this function will not work in 64-bit Windows 7.

So, the guy was very disappointed but I stayed as "cool as a cucumber" because I knew that there were several, great, free virtual machine programs that will allow you to run these older 16-bit programs on Windows 7 64-bit.

These are the programs that I recommend (especially # 2 & # 3):

1) DOSBox (DOSBox is a DOS emulator and only runs 16 MS bit-DOS programs and not 16 bit Windows Applications).

2) VirtualBox (a "virtual machine" That Allows an unmodified operating system with all of its installed software to RUN in a special environment, on top of your existing operating system).

3) VMware Player . (A "virtual machine" That will RUN legacy Windows applications on top of your existing operating system without interfering with the original OS).

Have fun continuing to enjoy your older programs on your brand new Operating System !!

[ad_2]

Source by Randy Knowles

Technical Writing – Components Of Windows User Interface In Software Documentation (2) – Window

[ad_1]

User interface documentation, one of the important tasks in software documentation, requires clear and consistent definition of all interface components. In this second part of the series, we continue with our survey of the most important interface components that a technical writer should be familiar with.

NOTE: Windows, Mac and Linux machines all have different user interfaces, depending on the particular Operating System (OS) (or "distribution" in the case of Linux) installed on your machine. This series is limited to the Windows interface only.

First of all, let's clarify the conceptual difference between a SCREEN and a WINDOW.

A SCREEN, as defined by Microsoft, is the "graphic portion of a visual output device." It is sometimes used interchangeably with a "MONITOR" or a "DISPLAY." Sometimes both are used together as in the retronym "monitor screen."

A WINDOW, on the other hand, refers to the individual display area surrounded by a FRAME and display when the user clicks a button or selects certain menu options.

A "screen" displays one or more "window" (s) but not the other way around.

A "screen" has one size which is the size of the monitor. Every "window," on the other hand, might have a different size depending on the user preference.

A "window" is a more abstract term when compared to a "screen" and that's why although there is a "screen RESOLUTION" (number of pixels in a unit length of screen), there is no corresponding "window resolution." There is, for example, "screen SAVER" programs. But there are no similar "window savers." You can save and close a window but a screen, as the physical medium of the interface, is there always, no matter which window (s) it is displaying.

When there are multiple windows open in a screen, the window that is selected and responds to user commands is referred to as the window in FOCUS. By "focusing" on a window you select it and make it respond to your interaction.

[ad_2]

Source by Ugur Akinci

Easy Steps to Stop SMTP AUTH Relay Attack and Identify Compromised Email Account for Postfix

[ad_1]

Today lots of the email application such as Sendmail, Postfix, or even MS Exchange has been re-designed to reduce the possibility of become an 'spam-relay'. From our experience, most of the SMTP AUTH relay attack is caused by the compromised of the weakly password protected user accounts. Once the accounts discovered and been compromised. Spammer authenticate using the user credentials, they are granted to relay via the server, which is then used to send spam.

Below are the easy steps to stop these spam emails quickly and identify which account (s) has been compromised.

Step1: Stop on on-hold mail queue.

Large amount of spam emails keep queueing your mail spool. What even worst is all the spam it fill up all your / var. Thus, it is always to hold the mail queue for temporary until you find out the which account has been exploited by spammer and send a large amount of emails.

Step2: Check your mail log.

Go to / var / log / maillog to have a quick look on the line with from: <>. You might see lots of email domain name there are not belong yo your organization. This is due to the spammer is faking the mail from: <>.

Step 3: Identify compromised account authenticating SMTP AUTH connection

Next, let us check those email accounts that has been exploited. Run a have cat grep sasl_username and sort it. You should see a long list of the login attempt and session for those exploited account. You can also do a quick calculation by running wc -l command to see total sessions for a particular user.

Step4: Disable the exploited email account.

Once, we have SASL_username string, which is the user account. You are advised to disabled or change the password to complex password.

Step 5: Move the mail queue or delete the spam email

Now, we have to deal with our mail queue. Easier and fastest way is to move your mail queue and do the housekeeping later. Or, you can delete those spam email using Bash script.

Step 6: Release Mail queue

Remember to release mail queue after our housekeeping process and keep on monitoring of the mail traffic.

[ad_2]

Source by James Edward Lee

WMV Files – Play Your Tune

[ad_1]

World's topmost company Microsoft Corporation developed a format better known as Windows Media Video or WMV in short which is basically used to view videos in a computer or laptop. This type of video format works well with any of the common players like Windows Media Player, Real Player, VLC Media Player, KM Player, Win amp and not to forget the giant Power DVD. The first version WMV 7 which was developed in the year 1999 and was successful.

One of the major reasons for using these files is that it allows mega capacity videos to be easily compressed without affecting their quality. These files can be played by the use of a set of codecs. A codec is a small program that can read a file, create video and audio formats from the data given.

WMV files when played on PC

There are few basic yet essential streps required that you need to follow to play such files in your personal computer.

1. If your computer already has a Windows Media Player program, WMP, then update its latest version so that you can play those video files properly. You can do this by downloading from the Microsoft Windows Media Player website. But, In case you are not able to view these on your system, then Windows can give you an error message mentioning that WMV files can not be opened. For this, you need to identify which program can open those files or your registry may be damaged.

2. Now, open the Windows Media Player from your PC and select the video file to be played.

3. You can select multiple files to be played in WMP.

4. If you do not wish to use WMP, then you can use other players that support this format such as Win amp, Power DVD, VLC etc

WMV files when played on Linux

Windows Media Video can be played in Linux using a compatible media player. Linux supports Video LAN Client or VLC player through which you can play your files. VLC player supports format of WMV files directly. Some of common players usually used in Linx are Boxee, Real Player, Mplayer and Helix Player.

WMV files when played on Macintosh

You can also run your video files in the Mac OS using the Mac Version of Windows Media Player. Apple computer supports Apple Quicktime media player which can also play WMV files. For this, you need to install File4mac plugin. It is a freeware that can be downloaded from Microsoft website.

WMV files can not be played on Vista since it is an operating system. It does not play anything.

Happy tuning to all viewers !!

[ad_2]

Source by Rupa R Sinha

Introducing: SAP ASE Edge Edition – Retiring Sybase ASE SBE

[ad_1]

This might be the biggest announcement from SAP you never heard of. After dropping the name Sybase from its product names last year, SAP is quietly reshaping its database platform offerings. And I mean this in a good way.

Under the Sybase name there were 2 ASE products; Sybase ASE Enterprise Edition (EE) and Sybase ASE Small Business Edition (SBE). The Sybase ASE EE product was and still is the flagship and the most commonly known edition of Sybase. But it came with a hefty price ticket. To offer a Sybase ASE database server to the SMB market space, Sybase created ASE SBE, limited to 2 CPU sockets and 8 engines on a physical server, at a very low price.

The server virtualization revolution has dramatically changed the server landscape and database servers made their transitions to the new world. The majority of newly deployed database servers are virtualized, either on premise or in the cloud. The Sybase ASE EE 15.7 database server enabled Sybase clients to make the move to the virtual servers with the introduction of the threaded kernel model. SAP ASE EE 16 continued the optimization for virtual servers and offers one of the most advanced database servers in the market.

However, Sybase ASE SBE never made the step into the virtual world and that was bad news for SMB, who are trying to save money on infrastructure costs. Hence the introduction of SAP ASE Edge Edition .

SAP ASE Edge Edition will retire the old Sybase ASE SBE. It is based on the SAP ASE EE 16 edition with a limit of 4 cores. Other than that, SAP pulled out the stops and created an entry level ASE server that packs features that other databases only offer in their enterprise edition, but set a price point that competes with other vendor's standard edition database.

The following matrix shows the comparison between SAP ASE Edge Edition and Sybase ASE SBE. But pay close attention to the options that are now included and compare this to other vendors standard offerings.

Limits / Options
ASE Edge Edition
ASE SBE (retired)

Max Engines
No Limit
8

Max Cores OS can use
4
No Limit

Max CPU Chips
No Limit
2

Max Concurrent User Connections
No Limit
256

Options

High Availability
X
X

Disaster Recovery Package
X
X

Security and Directory Services

X

Encrypted Columns

X

Partitions

X

Active Messaging
X
X

Compression

X

In Memory Database
X
X

Advanced Backup Services (TSM)
X
X

Enterprise Connect – Oracle
X
X

Enterprise Connect – ODBC
X
X

  • (Included) X (Not Available)

SAP ASE Edge Edition also includes unlimited cores of SAP Replication Server Premium Edition, restricted to warm standby capabilities of SAP ASE Edge data.

If you're running Sybase ASE SBE today in either server or user based licensing, you should take a closer look at SAP ASE Edge Edition. The savings in server virtualization alone can justify the investment.

If you're running a shareware database server and would like to upgrade to an enterprise class database system, running on Linux and Windows servers, you should talk to us about SAP ASE Edge Edition.

If you're planning on implementing a commercial database server in your company and or product, SAP ASE Edge Edition should be on your checklist.

Call us today at 813 322 3240 to learn more about SAP ASE Edge Edition.

[ad_2]

Source by Peter Dobler

How To Repair The Acer D2D Recovery

[ad_1]

This tutorial can also help to do it on other computer brands

Disclaimer: First of all you must be aware that some of the operations to come can cause irreversible change on your hard disk, I recommend to you and I will never make it enough make a backup of your system before launching you in any hazardous operation. Any damage and / or modification done on your system will be under your whole responsibility. The following procedures were done on a Acer Aspire 5102wlmi and some also functioned on a Dell Inspiron 9400/1705.

As you know, the Acer computers and those of other manufacturers are now delivered with a system of restoration installed in a hidden partition of your hard disk. This system launches out while pressing keys ALT + F10 simultaneously. And sometimes for various reasons this system ceases functioning.

The first cause often comes owing to the fact that function D2D Recovery is disable in the bios (menu principal).

The solution: enable the function and try to press keys ALT + F10 during the starting of the computer.

The second cause: in this case hidden partition PQSERVICE was erased or damaged, or you replaced the disc and in this case it is not present.

The solution: If you did not previously make a backup of your system by making an image disc. It will not be possible to use the D2D recovery. Your only hope will be to have in your possession Acer Recovery CD / DVD.

And the third causes: the Acer Master Boot Record (MBR) was damaged or replaced by non-Acer MBR. As long as partition PQSERVICE is present or that you can put the hand on the necessary Acer files you can reinstall the MBR of Acer.

The solution:

First method: on a functional Windows system :

1 disable the D2D recovery option of the bios.

2 open a Windows session with an account administrator.

3 Download, unzip and launch partedit32 (registration required for download).

4 Identify the Pqservice partition by its size (at the bottom of the partedit window there is a partition information box) it is a small sized partition approximately 2 to 6 Go.Once made change the type of your partition into 0C and save. Restart and open a session with an administrator account, you should be able to navigate to the PQservice partition. Seek these two files mbrwrdos.exe and rtmbr.bin once localised open a command prompt and launch this command mbrwrdos.exe install rtmbr.bin, this will install the Acer MBR. Close the command prompt window restart again Windows go into the bios and reactivate the D2D recovery. Now ALT + F10 should launch Acer recovery at the starting of the computer.

Second method: On a nonfunctional Windows system .

For that you must use a Linux distribution (for me Mandriva provided all the tools necessary).

1 Boot on the Mandriva install CD / DVD the boot menu will give you the possibility to repair or to restore the Windows boot loader.

2 If that is not enough launch an installation of linux (this will be an occasion to test this terrible OS) and choose LILO as boot loader (a boot menu that allow you to choose between several operating systems) once finished the installation. Restart your computer in the boot loader menu system you will have at least 2 Windows options the first generally point to PQservice choose it and you will boot directly into acer D2D recovery.

The last solution is the simplest one, just note that during the Linux installation you will have to resize your Windows partition to create a place for a new Linux partition it is the most perilous part because irreversible, therefore take your precautions at this time.

[ad_2]

Source by Alan Bradock

IBM iSeries Utilities For Data Interchange

[ad_1]

1. Introduction

The IBM iSeries computers, still commonly known as AS / 400 systems use the IBM successful DB2 database to store and access data which are organised into files with the following characteristics:

  • They are structured in data fields which usually have a fixed length and type
  • They have external data definitions which can be used by application programs
  • Numeric data can be stored in packed format where each digit is stored in a semibyte.
  • Data are coded in EBCDIC

Other systems such as Linux / Unix and Windows use files which are just a sequence of bytes (normally coded in ASCII) and therefore are known as stream files. Often their fields have not a fixed length and are delimited by a special field delimiter character such as a semicolon, a colon or a pipe (field delimited files are often produced by exporting data originally stored in spreadsheets such as Microsoft Excel or databases such as Microsoft Access).

It is often necessary or useful to transfer files between the IBM iSeries (AS / 400) and PCs and Linux / Unix systems, but the different file organisations described above often make such transfers complicated and painful.

This article described some approaches to simplify the work.

2. IBM useful commands

The IBM AS / 400 uses an integrated file system (IFS) that allows to use on the same server different file organisations such as those used by Linux / Unix or Windows and the native AS / 400 ones. The native AS / 400 files are stored in libraries or DB2 collections within the QSYS.LIB. Other file systems exist in the QOpenSys (similar to Unix) or the QDLS (used to store documents and files in PC formats) environments.

The IFS allows to use on the same server Linux / Unix based applications together with the native AS / 400 applications.

The AS / 400 Operating system provides some useful commands to simplify the data interchanges between different file systems as described below:

  • CPYFRMIMPF to copy data from IFS to the AS / 400 database system
  • CPYTOIMPF to copy data from the AS / 400 database system to IFS
  • CPYFRMSTMF to copy stream files into AS / 400 database files
  • CPYTPSTMF to copy AS / 400 database files to stream files
  • CPYTOPCD to copy AS / 400 database files to PC documents, stored in the QDLS folders
  • CPYFRMPCD to copy PC documents in the QDLS folders into AS / 400 database files

The CPYTOPCD and CPYFRMPCD commands are specific for the QDLS system and have not many options whereas the other ones allow to use many options and are more flexible. They look similar, but there are important differences as follows:

CPYFRMSTMF converts text files (stream files that are in text format) to physical files. It has no concept of fields, so it can only write records to program described files (ie files that have no fields defined) or source pfs.

CPYFRMIMPF converts text files as well, but it tries to interpret fields in the input file and copy them to the appropriate fields in the output file. You can either import delimited fields (for example, comma separated value (CSV) files, tab-delimited files, pipe delimited files, etc) or you can read input from fixed-position fields (you have to define the record layout in a " field definition file ")

An example of the second command is the following:

CPYFRMIMPF FROMSTMF ( '/ Fldr1 / File1.CSV') TOFILE (Lib1 / FILE3) MBROPT (* REPLACE) RCDDLM (* CRLF) DTAFMT (* FIXED) FLDDFNFILE (Lib1 / FILE4)

The example above uses a fixed data format (ie not delimited) and uses a field definition file (FILE4) to describe the text file fields as follows:

– This is comment
– DBFieldname startpos endpos nullIndpos
field1 1 12 13
field2 14 24 0
field3 25 55 56
field4 78 89 90
field5 100 109 0
field6 110 119 120
field7 121 221 0
* END

The above would be needed to import the text file data into a DB file with field names of: FIELD1, FIELD2, FIELD3, …, and FIELD7. The * END is required. I think you can leave off the third column if no fields are null capable.

3. Some User Utilities

The commands above are useful and normally perfectly adequate, but they can be complex especially when the data fields to be copied are not in the same sequence or when one wants to extract only some data from the text file.

I was involved in a few system migration exercises where such copies between Unix, PCs and AS / 400 systems had to be done frequently and I developed therefore some utilities to simplify these activities.

The utilities have the objective to satisfy following requirements:

  • Support of any separator character used to delimiter the fields
  • Possibility to copy valid data into fields defined as alphanumeric, numeric or packed numeric
  • Possibility to copy data stored in different sequences in the two files. For instance it should be possible to copy fields 1, 3,4 and 6 of the text file into the fields 5, 2, 1 and 4 of the target database file.
  • The utility should be able to store the file fields mappings (such as those described above) to allow the user to simply use the previously entered mapping.

I organised the utilities in a few commands and programs as follows:

a) Command UCPYFTP to control the copy between two files. The command requires to enter following parameters:

AS400 DB File. . . . . . . . . TOFILE …….

AS400 Library. . . . . . . . . TOLIB * LIBL

AS400 Member. . . . . . . . . . TOMBR * FIRST

FTP File. . . . . . . . . . . . FROMFILE …….

FTP Library. . . . . . . . . . FROMLIB …….

Field Separator # T = TAB]. . . . SEPARATOR '|'

Decimal Point. . . . . . . . . DECPOINT '.'

View Field Mappings (Y / N). . . VIEWMAP 'N'

Up to Record No. . . . . . . . . UPTOREC 0

b) Program UFMA01L to display and maintain existing file mappings.

The display looks as follows:

UFMAP30 MAPPING FILE MAINTENANCE 20/02/09 10:03:38

AS400 Database File: WERCSWKF FTP File: WERCS

Seq AS400 Fld Description Type Len D From

No. Name FldN

1 WK0003 WK_CLIENTE A 9 3

2 WK0004 WK_CLI_SAP A 10 4

3 WK0005 WK_RAGSOC A 40 5

4 WK0006 WK_ZIP A 5 9

5 WK0016 WK_ADDRESS1 A 100 17

6 WK0017 WK_ADDRESS2 A 100 19

7 WK0101 WK_INDI A 30 0

8 WK0102 WK_CAP A 5 0

9 WK0103 WK_LOC A 25 0

10 WK0104 WK_PROV A 2 0

Fine

F3 = Exit F6 = Update Mappings F9 = Use sequential mapping F11 = Process

The screen shows that field number 3 of the FTP file is copied to the first field of the database file called WK0003, field 4 is copied to WK0004 and so on. The fields for which the number is zero are not copied, but are initialised correctly in the target file (with zeros or blanks).

Notice following points:

  • The file to be copied is called FTP file because normally is sent to the AS / 400 by using an FTP transfer.
  • The user must specify the name and library of both the FTP file and the target AS / 400 database file.
  • The commands use some defaults for the field separator and decimal point, but these can be changed by the user.
  • When the View Field Mappings parameter is set to 'Y', the user will see previously defined field mappings or enter new mappings.
  • When the user invokes the command for the first time on a new couple of ftp and target files, the program extracts the field definitions of the database file and displays the mapping screen to allow the user to enter the field mappings which are then stored to allow a future re-use.

A similar utility called UCPYTOFTP allows to copy the data from an AS / 400 database file to a text file to be downloaded to a Linux / Unix or Windows machine.

The Utilities and their documentation can be downloaded for free from my website. The programs are free software that can be redistributed and / or modified it under the terms of the GNU General Public Licence as published by the Free Software Foundation.

[ad_2]

Source by Mario Pesce