Wednesday, December 12, 2012

Convert Gregorian Date (YYYYMMDD) to Julian date(YYYDDD) and vice versa

 

The easiest ways to convert Julian date (YYYYDDD) to Gregorian equivalent is using COBOL Intrinsic functions.

Here is the function and its descriptions.

Function Description
DATE-OF-INTEGER Gregorian date equivalent (YYYYMMDD) of integer date
DAY-OF-INTEGER Julian date equivalent (YYYYDDD) of integer date
INTEGER-OF-DATE Integer date equivalent of Gregorian date (YYYYMMDD)
INTEGER-OF-DAY Integer date equivalent of Julian date(YYYYDDD)
*** The integer date is a seven-digit integer with a range from 1 to 3,067,671. (dates ranging from January 1, 1601 thru December 31, 9999).
The Gregorian date is obtained from the calculation (YYYY * 10,000) + (MM * 100) + DD.
o YYYY represents the year. It must be an integer greater than 1600, but not greater than 9999.
o MM represents a month and must be a positive integer less than 13.
o DD represents a day and must be a positive integer less than 32, provided that it is valid for the specified month and year combination.

The returned value of INTEGER-OF-DATE/DAY functions is an integer that is the number of days the date represented by given input, succeeds December 31, 1600 in the Gregorian calendar.

Sample Program

IDENTIFICATION DIVISION.
PROGRAM-ID.  DTECNV.
DATA DIVISION.

WORKING-STORAGE SECTION.
01 WS-WORK-AREA.
     05 WS-GREG-DATE                  PIC  9(08).
     05 WS-JULN-DATE                  PIC  9(07).
     05 WS-INT-DATE                   PIC  9(07).
PROCEDURE DIVISION.

A0100-MAIN-PARA.
     ACCEPT  WS-GREG-DATE.
*  Gregorian date YYYYMMDD To Julian date  YYYYDDD
     COMPUTE WS-INT-DATE  = FUNCTION INTEGER-OF-DATE(WS-GREG-DATE)
     COMPUTE WS-JULN-DATE = FUNCTION DAY-OF-INTEGER(WS-INT-DATE).
     DISPLAY 'GREGORIAN DATE        : '  WS-GREG-DATE.
     DISPLAY 'JULIAN    DATE        : '  WS-JULN-DATE.

     ACCEPT  WS-JULN-DATE.
*  Julian Date YYYYDDD To Gregorian Date YYYYMMDD**
     COMPUTE WS-INT-DATE  = FUNCTION INTEGER-OF-DAY(WS-JULN-DATE)
     COMPUTE WS-GREG-DATE = FUNCTION DATE-OF-INTEGER(WS-INT-DATE)
     DISPLAY 'JULIAN    DATE        : '  WS-JULN-DATE.
     DISPLAY 'GREGORIAN DATE        : '  WS-GREG-DATE.
     STOP RUN.

 

Output

image

Hey Guys. if my tutorial helped you please support me by liking my facebook page, sharing this webpage with your friends and commenting below. If you want me to update or add me some specific tutorial please cooment to this page or email me at shibuthannikkunnath@gmail.com

-Cheers – Shbibu Thannikkunnath

Tuesday, December 4, 2012

IBM Mainframe Payroll Project

Are you looking for mainframe projects?, then this is the right place for you. Right now I have 2  Projects  ( Mainframe projects with Source code ) coded with COBOL, have utilized LE xml service and GDGs. you might be able to tune these projects, so please post your valuable comments and snippets.

This is just a starting a series of mainframe projects, I’ll be uploading more projects in coming days. Also if you need a project or you have some suggestions please write to me at shibuthannikkunnath@gmail.com.

You might face few issues while uploading and running the applications and may think that the provided documentation is not enough. In those situations please drop me a mail at shibuthannikkunnath@gmail.com and I can help you to clear all the doubts regarding the projects.

1. MAINFRAME PAYROLL PROJECT.

This project is for generating calculating employee's salary and generate pay slip. This application will also generate xml log for the pay slips generated and can be used to monitor in future by feeding to xml log monitoring application or you can even send it to a web service!.

I have coded these applications in my machine and xmitted and downloaded them.

Step 1. Download the binary format source and and dependent files.

download link

http://www.mediafire.com/?6th6w35ns4lk182

The above zipped file contains a couple of binary files, download zip file and unzip it and keep the binary files in your local drive.

Step 2. Upload files to mainframe.

At this point of time I’m assuming that you have IBM personal communications installed in your machine, I mean any emulator is fine. Since I’m using PCOMM the I’m gonna explain from the PCOMM point of view ;).

Login to mainframe TSO session

image

Chose option 6 (command).

image

Now choose Actions from the Menu bar and select send file to host.

image

Click on browse and chose the first file from the zipped folder. and chose Binary as the transfer type for all files and click on update in list or add to list then click on send. Do not forget to put quotes before and after the server file name, this to avoid the automatic padding of your RACFID by zOS.

use the bellow server file name for all the respective files.

PAYROLL.CLAIMFLE
PAYROLL.EMPFILE
PAYROLL.JCLS
PAYROLL.PAYFILE
PAYROLL.SOURCE
PAYROLL.FLECPYBK

Step 3. Inflate the binary files.

Here we are expanding all the binary files to their original format, go to ISPF main option 6 (Command) and type

receive indsn(‘<binary filenames>’) , don’t forget the quotes

eg: receive indsn('PAYROLL.CLAIMFLE')

you will get a message like below one, just press Enter key

INMR901I Dataset TSHRCI.PAYROLL.CLAIMFLE from R0318B on N1
INMR906A Enter restore parameters or 'DELETE' or 'END' + 

You will get a successful message like below. if not try again “ watch for the quotes”

INMR001I Restore successful to dataset 'TSHRCI.PAYROLL.CLAIMFLE'

repeat the step 3 for all the 6 files there in the downloaded zip file.

Step 4. we are almost there, verify the files

go to ISPF option 3.4, and type “TSHRCI.PAYROLL” in dsname level and press enter you will get a screen almost like below. except TSHRCI.PAYROLL.PAYSLIP.GROUP  and TSHRCI.PAYROLL.XMLLOG.GROUP.

image

Step 5. Build the supporting GDGs

Go to TSHRCI.PAYROLL.JCLS and put an “e” in front of GDG and hit enter key.

right now this is the pay slip GDG JCL, so submit it to create pay slip GDGs

Now modify the JCL to below JCL (Changes are marked in red color) and submit it.

//R0318BJ  JOB 'SHIBU THANIKKUNNATTH',NOTIFY=&SYSUID
//GROUP    EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
DEFINE GDG(NAME(TSHRCI.PAYROLL.XMLLOG.GROUP)-
LIMIT(3)                -
NOEMPTY                 -
SCRATCH)
/*
//MODEL    EXEC PGM=IEFBR14
//GDGMODEL DD   DSN=TSHRCI.PAYROLL.XMLLOG.MODEL,
//         DISP=(NEW,CATLG,DELETE),
//         UNIT=SYSDA,
//         SPACE=(TRK,0),
//*        VOL=SER=EUTDSD,
//         DCB=(LRECL=80,RECFM=FB,BLKSIZE=800,DSORG=PS)
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD DUMMY
//GDS      EXEC PGM=IEBGENER
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   DUMMY
//SYSUT1   DD *
RECORD-100001
RECORD-100002
/*

//SYSUT2   DD   DSN=TSHRCI.PAYROLL.XMLLOG.GROUP(+1),
//         DISP=(NEW,CATLG,DELETE),
//         SPACE=(TRK,5),
//         DCB=TSHRCI.PAYROLL.XMLLOG.MODEL,
//*        VOL=SER=EUTDSD,
//         UNIT=SYSDA
//SYSIN    DD DUMMY
//


Line marked in PINK color is the DASD volume, if your site is not SMS managed you have to provide the volume serial number, if you don’t know the vol ser, you can contact z box system admin.

Now if you go back to ISPF main option 3.4 and TSHRCI.PAYROLL.* you can see your screen as below.

image

Step 6. Time to review contents of all the datasets.

go to First file (TSHRCI.PAYROLL.CLAIMFLE) and you can see the below screen

image

This is the file which employees will claim their billed hours for a whole month. The structure is as given below

FD-CF-MONTH               PIC X(03).
FD-CF-WEEK                PIC X(01).
FD-CF-EMPID                PIC X(10).
FD-CF-BILL-CDE            PIC X(02).
FD-CF-SUN                    PIC X(03).
FD-CF-MON                   PIC X(03).
FD-CF-TUE                    PIC X(03).
FD-CF-WED                   PIC X(03).
FD-CF-THU                     PIC X(03).
FD-CF-FRI                      PIC X(03).
FD-CF-SAT                     PIC X(03).
First 3 chars for the month, Next 1 char for the week(1,2,3,4), next 10chars for employee id, entered ID should have an entry in TSHRCI.PAYROLL.EMPFILE, next 02 chars are for bill codes we can use bill code for claiming over time valid values( 01 for basic claiming, 02 for leave hours, 03 for week day overtime, and 04 for weekend over time) these bill codes should have matching entry in TSHRCI.PAYROLL.PAYFILE  with band code of the employee. Next 7 fields of 3 characters are for daily hour claiming.

e.g. JAN1100000000101000008008008008008000

says: its for Jan First week, for employee ID 1000000001, basic hrs, and 0hrs  for Sunday, 8 hrs each for Monday, Tuesday, Wednesday, Thursday, Friday and 0hr for Saturday.

Now go to TSHRCI.PAYROLL.EMPFILE, File structure is given below.

05  FD-EF-EMPID              PIC X(10).
05  FD-EF-FNAME             PIC X(10).
05  FD-EF-LNAME             PIC X(10).
05  FD-EF-ADD1                PIC X(10).
05  FD-EF-ADD2                PIC X(10).
05  FD-EF-PH                    PIC X(13).
05  FD-EF-DOJ                  PIC X(10).
05  FD-EF-DOB                  PIC X(10).
05  FD-EF-LASTPAYED      PIC X(10).
05  FD-EF-EMPMODE        PIC X(03).
05  FD-EF-STATUS            PIC X(03).
05  FD-EF-PAYMODE        PIC X(01).
05  FD-EF-BAND               PIC X(02).

First 10 bytes for employee id, next 10 for first name and next 10 for last name, next 10 for address line1 and next 10 for address line2, next 13 bytes for phone number, next 10 bytes for date of birth,, next 10 bytes for last paid month its for future enhancement. next 3 bytes for employment mode valid values are per for permanent and con for contract. next 3 bytes for status 001 is active and 002 is resigned, next 2 bytes for band can have any value but the band value should have a matching entry in TSHRCI.PAYROLL.PAYFILE.

image

Now go to TSHRCI.PAYROLL.FLECPYBK

This data set contains the file structures of all data sets, It has been created to refer the files at any point of time if you do not access to our web sites, and to avoid to messing up our code B)

Now go to TSHRCI.PAYROLL.JCLS

This PDS contains the JCL’s for compiling our code, running our application, creating GDG’s and deleting GDG’s. GDG operations has been explained in Step 5.

BATCHBOB.

This JCL can used to compile the cobol application, if the IGYWCL proc is in the 'SYS1.ADMIN.PROCLIB' and IGYWCL has been undergone some tweaks to accept member name, srce lib and load lib parms. right now this is the only cause in IBM internal training machines.

COBCPL.

I believe this JCL must work in almost all the mainframes that has IBM Cobol version 4.1.  this job directly call the IGYWCl which is the part of COBOL ver 4.1 so  it should work without making any noises.

“If you have any issues with writing compile JCL for our project please write back to  me at shibu@hotmail.co.in  I can always help you to get a fully functional compile JCL"

Execpgm

This JCL is for executing our application. If you go to this JCL you can see that I have commented out a couple of lines (//*           VOL=SER=EUTDSD,) these are the volume serial numbers, since my machine is SMS managed I do not have to worry about the vol ser numbers, SMS will take care of it.

If your site is not SMS managed you have to un comment these line and change the volume serial number to the volume where GDGs resides. If you go to ISPF 3.4 option you can see volume at the right side of your dsn, see the below screen shot, for TSHRCI.PAYROLL.JCLS the vol ser is ETRU03.

image

GDG and GDGDEL

These are the JCLS for creating and deleting GDGs. PLease refer to Step 5 for more information.

Now go to TSHRCI.PAYROLL.PAYFILE

“Soon you opened the dataset please enter num off command in order to avoid any data lose"

This file is all about the MONEY, we have to declare the hourly charge for different bands.

File structure is

05  FD-PF-BAND                 PIC X(02).
05  FD-PF-HOURLY             PIC X(04).
05  FD-PF-DAILY                 PIC X(04).
05  FD-PF-MONTHLY           PIC X(06).
05  FD-PF-OVERTIME          PIC X(03).
05  FD-PF-LEAVE                PIC X(04).
05  FD-PF-WEEKENDOT     PIC X(03).

First 2 bytes are for Ban number, next 04 bytes are for per hour charge for normal (8hrs per day) work hours if the guy is working as per hour plan, next 4 bytes are for per hour charge normal (8hrs per day) work hours if the employee is working in daily wage plan, and next 4 bytes are for per hour charge for normal work hours(8hrs per day) if the employee is working in monthly wage plan. next 3 bytes are the amount needs to bill if the employee worked week day over time. Next 4 bytes are the amount needs to charge if the employee went on vacation ( normally no company will reduce any amount from salary, so we) . next 3 bytes are for the amount needs to charge if the employee worked on weekend over time.

e.g. 05020010000300003000200100

The above line says band is 05, 200 for hourly wage, 1000 for daily wage, 3000 for monthly wage, 300 if employee was on week day over time, 200 if employee was on leave/vacation, and 100 if employee worked on weekend over time.

Now go to TSHRCI.PAYROLL.SOURCE

PDS contains the source code, you have all the freedom to work on the source code.

Please do not change the Author name!

Step 7 Most important: create load lib

Load lib is the pds where our compile and exec pgm JCL are pointing to. So let create it. This PDS will be same for all our projects so don’t be a miser, allocate few cylinders.

Go to ISPF 3.2 screen fill the screen as below

image

press enter

Ignore the management class, storage class, volume serial, device type, data class and fill out the remaining fields as in below screenshots

image

Press enter to finish it up.

image

We are done with the setups. now lets go and run the code!.

Step 8. Run the code

If you want you can edit claim file, if you want to claim your own billed hrs. but don't forget to add your own employees and band details also. Other wise app will abend!. :D. PLease be aware the code will work fine with the provided data.

Now go to TSHRCI.PAYROLL.JCLS and submit compile JCL

image

compile JCL should return MAXCC 0

after that submit EXECPGM jcl.

image

our program will return maxx cc 0, almost in all the cases, please review the data sets again if you have made any changes (Refer 5 and 6 to know the file structures and GDGs)

Go to spool and verify the claims processed  flow and the data (if needed)

image

Now, its the time review the GDGs

Pay slip

Go to ISPF 3.4, DSNAME level TSHRCI.PAY* and open the latest TSHRCI.PAYROLL.PAYSLIP.GROUP.* gdg.

and you can see the pay slips generated for our employees, of the inputted month.

image

XMLLOG

go to ISPF 3.4, DSname level TSHRCI.PAY* and open the latest version of TSHRCI.PAYROLL.XMLLOG.GROUP

image

That' is it. keep exploring the project, do tweaking, but do not forget to write to me your experiences and your doubts or what ever related to mainframes at shibuthannikkunnath@gmail.com

 

Friday, November 30, 2012

Submit or Retrieve Jobs with FTP / Alternative For Remote Job entry (RJE)

This post is about an alternative for remote job entry, you can use the TCP/IP FTP service in zOS and a Shell/command prompt to retrieve, List, and submit Jobs to Mainframe.

Basic Commands used in this article

FTP                   - To start FTP
Open remore_system_ip - To connect to host via FTP
QUOTE site filetype=JES     - Connect to JESPLEX, (conect to JES in layman terms)
DIR                   - List Jobs
Get filename          - Get Job dataset from remote system
PUT filename          - Submit Job

Make Sure that the FTP is up and running in your mainframe system.

You can do this by find the “TCPIP” job in your spool.

Connect to Mainframe via FTP

Open the command prompt/Shell and Enter FTP.
Enter Open your mainframe_host_ip
Enter your user ID followed by password


C:\>ftp
ftp> open demomvs.demopkg.ibm.com

Connected to demomvs.demopkg.ibm.com.
220-FTPD1 IBM FTP CS V1R13 at demomvs.demopkg.IBM.COM, 05:53:23 on 2012-11-30.
220 Connection will close if idle for more than 5 minutes.
User (demomvs.demopkg.ibm.com:(none)): dds1764
331 Send password please.
Password:
230 DDS1764 is logged on.  Working directory is "DDS1764.".
ftp>

At this point you are connected to MVS subsystem,  if you issue a DIR you can see your MVS datasets, issue SITE FILETYPE=JES to get connected to JESPLEX

ftp> quote site filetype=jes
200 SITE command was accepted

Issue a DIR command to see the jobs.

Unlike SDSF, the dir command display the last ran job, first in the list

ftp> dir
200 Port request OK.
125 List started OK for JESJOBNAME=DDS1764*, JESSTATUS=ALL and JESOWNER=DDS
JOBNAME  JOBID    OWNER    STATUS CLASS
DDS1764J JOB01982 DDS1764  OUTPUT A        RC=0000 6 spool files
DDS1764J JOB01683 DDS1764  OUTPUT A        RC=0000 6 spool files
DDS1764J JOB01682 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01681 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01680 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01678 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01676 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01675 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01673 DDS1764  OUTPUT A        RC=0016 4 spool files
DDS1764J JOB01672 DDS1764  OUTPUT A        RC=0016 4 spool files
DDS1764J JOB01667 DDS1764  OUTPUT A        RC=0016 5 spool files
DDS1764J JOB01665 DDS1764  OUTPUT A        RC=0012 4 spool files
DDS1764J JOB01662 DDS1764  OUTPUT A        (JCL error) 3 spool files
DDS1764C JOB00417 DDS1764  OUTPUT A        RC=0000 6 spool files
DDS17641 JOB00414 DDS1764  OUTPUT A        RC=0012 4 spool files
DDS1764E JOB05786 DDS1764  OUTPUT A        RC=0000 4 spool files
DDS17641 JOB04559 DDS1764  OUTPUT A        RC=0000 5 spool files
DDS17641 JOB04557 DDS1764  OUTPUT A        RC=0012 4 spool files
DDS17641 JOB04555 DDS1764  OUTPUT A        RC=0012 4 spool files
DDS17641 JOB04498 DDS1764  OUTPUT A        RC=0012 4 spool files
DDS1764  TSU01992 DDS1764  ACTIVE TSU
250 List completed successfully.
ftp: 1430 bytes received in 0.70Seconds 2.03Kbytes/sec.
ftp>

Issue DIR JOBID to see the files associated with the JOB

ftp> dir JOB01982
200 Port request OK.
125 List started OK for JESJOBNAME=DDS1764*, JESSTATUS=ALL and JESOWNER=DDS1764
JOBNAME  JOBID    OWNER    STATUS CLASS
DDS1764J JOB01982 DDS1764  OUTPUT A        RC=0000
--------
         ID  STEPNAME PROCSTEP C DDNAME   BYTE-COUNT
         001 JES2              A JESMSGLG      1137
         002 JES2              A JESJCL         425
         003 JES2              A JESYSMSG      4303
         004 STP010            A SYSOUT        2645
         005 STP010            A JNF1JMSG      2746
         006 STP010            A JNF2JMSG      2746
6 spool files
250 List completed successfully.
ftp: 500 bytes received in 0.00Seconds 166.67Kbytes/sec.

Issue GET JOBID.n “destination_file” to ftp the job files from Mainframe to your machine. If you issue GET JOBID.n (n is a number) you will get the nth file from JOB, if it is GET JOBID.X you will get all the files belongs to that JOB

ftp> get JOB01982.x "C:\temp1\JOB01982.x.txt"
200 Port request OK.
125 Sending all spool files for requested Jobid
250 Transfer completed successfully.
ftp: 22154 bytes received in 1.53Seconds 14.47Kbytes/sec.
ftp> get JOB01982.1 "C:\temp1\JOB01982.1.txt"
200 Port request OK.
125 Sending data set DDS1764.DDS1764J.JOB01982.D0000002.JESMSGLG
250 Transfer completed successfully.
ftp: 1312 bytes received in 0.00Seconds 1312.00Kbytes/sec.
ftp>

Issue PUT “JCLL_location”  (JCLL_location is the JCL file path in your local machine). Eg. in my Machine the JCL is located at “C:\temp1\sort_jcl.txt”

image

ftp> put "C:\temp1\sort_jcl.txt"
200 Port request OK.
125 Sending Job to JES internal reader FIXrecfm 80
250-It is known to JES as JOB02315
250 Transfer completed successfully.
ftp: 754 bytes sent in 0.37Seconds 2.02Kbytes/sec.
ftp>

Issue DIR to see the latest JOB

250 Transfer completed successfully.
ftp: 754 bytes sent in 0.37Seconds 2.02Kbytes/sec.
ftp> dir
200 Port request OK.
125 List started OK for JESJOBNAME=DDS1764*, JESSTATUS=ALL and JESOWNER=DDS1764
JOBNAME  JOBID    OWNER    STATUS CLASS
DDS1764J JOB02315 DDS1764  OUTPUT A        RC=0000 6 spool files
DDS1764J JOB01982 DDS1764  OUTPUT A        RC=0000 6 spool files
DDS1764J JOB01683 DDS1764  OUTPUT A        RC=0000 6 spool files
DDS1764J JOB01682 DDS1764  OUTPUT A        RC=0016 6 spool files
DDS1764J JOB01681 DDS1764  OUTPUT A        RC=0016 6 spool files

 

Guys try this yourself, if this post helped you, don’t forget to Comment/like/share the page and of course visit the below advertisement.

Cheers- Shibu Thannikkunnath

Installing and configuring 3270 Terminal emulator in Mac

Step 1. Download 3270 client for MAC OSX

Download tn3270 from here - http://www.brown.edu/cis/tn3270/index.html#latest . When I’m writing this article the latest version of tn3270 is 3.3b6 (beta). It worked perfectly in my 2012(mid) Macbook pro Retina display.

Step 2. Mount the dmg and open the disk in finder.

Screen Shot 2012-11-29 at 7.46.32 PM

Step 3. Copy tn3270x Application file to your applications folder

Step 4. Invoke tn3270x by double clicking on the application

Screen Shot 2012-11-29 at 7.50.15 PM

Fill your hostname on “Host Name” field. By default the port will be 23, but if you want you can change the port number by clicking on “Special” Button

Screen Shot 2012-11-29 at 7.52.40 PM

Once you are done with your settings, click on “open connection” Button.

Screen Shot 2012-11-29 at 7.55.50 PM

I have used Fandezhi/efglobe mainframe, it is a free mainframe and can be used for your skills development. If you want to know more about creating an id, visit my post about getting a free mainframe id (http://mainframegeek.me/2012/11/23/free-mainframe-id-to-practice/)

That’s it; you know how to go from here J Hey guys, if this post helped you, subscribe for my posts, share it or like my Facebook page.

Cheers –Shibu-

          

 

Installing and configuring 3270 Terminal emulator in Mac

Step 1. Download 3270 client for MAC OS

Tn3270 is absolutely free, you can download tn3270 from here - http://www.brown.edu/cis/tn3270/index.html#latest . When I’m writing this article the latest version of tn3270 is 3.3b6 (beta). It worked perfectly in my 2012(mid) Macbook pro Retina display.


Step 2. Mount the dmg and open the disk in finder.



Step 3. Copy tn3270x Application file to your applications folder

Step 4. Invoke tn3270 by double clicking on the application.



Fill your hostname on “Host Name” field. By default the port will be 23, but if you want you can change the port number by clicking on “Special” Button.



Once you are done with your settings, click on “open connection” Button.


I have used Fandezhi/efglobe mainframe, it is a free mainframe and can be used for your skills development. If you want to know more about creating an id, visit my post about getting a free mainframe id (http://mainframegeek.me/2012/11/23/free-mainframe-id-to-practice/)


 

That’s it; you know how to go from here

Hey guys, if this post helped you, subscribe for my posts, share it or like my Facebook page.

 

Cheers –Shibu-

Wednesday, November 28, 2012

Declare numeric field with More than 18 Digits in Cobol

Have you ever wondered about the 18digits maximum limit of Numerical variable declaration (PIC 9(18) ) in Cobol?

Well you can override it in Enterprise Cool, or in other words if Language environment (a.k.a LE) is available at your shop. The Language environment is introduced back in 2000 by IBM, which is a common application layer for many Programming languages. The LE has a lot of cool features which I’ll be covering future posts. So keep coming back.

Here is a sample program for Numeric field declaration with more than 18 digits. The Compiler directive (CBL) is that really turning the ship around.
This compiler-directing statement selectively suppresses output or causes output to be produced. The keywords *CONTROL and *CBL are synonymous.

The Program logic is simple its just move a 31 digit number to the number 1 variable, then add it with itself and display it.
If you Don’t have mainframe access to try it out, visit my post on getting a free mainframe id, it really helps.  http://mainframegeek.me/2012/11/23/free-mainframe-id-to-practice/ . It’s a raw mainframe so you won’t be getting handy compile JCL on this mainframe, let me know if you need one, I can help you.







 CBL ARITH(EXTEND)
IDENTIFICATION DIVISION.
PROGRAM-ID. COB18DIG.
AUTHOR.     SHIBU.T.
*
DATA DIVISION.
WORKING-STORAGE SECTION.
77  WS-NUM1                      PIC 9(31).
*
PROCEDURE DIVISION.
A0000100-MAIN-PARA.
MOVE 1234567890123456789012345678901
TO WS-NUM1.
DISPLAY 'WS-NUM1 BEFORE ADDITION: ' WS-NUM1.
ADD WS-NUM1                 TO WS-NUM1.
DISPLAY 'WS-NUM1 AFTER ADDITION: ' WS-NUM1.
STOP RUN.

 

The compile and run JCL will complete with return-code 000, here is the output I got in my machine.

image

Does my Program, post helped you? Comment, rate or like my facebook page (top right corner of this page) and click on the adds listed below. It really help me to make this website alive.

-Cheers, Shibu

Friday, November 23, 2012

Free Mainframe ID to practice.

Hey guys here is the Thanks giving gift. I’m not sure how many of you are aware about this.

You can access Fandezhi mainframe system for your Mainframe skills development, there is no hidden charges to use its (Read the below notes), yes it’s completely free.

efglobe/Fandezhi Mainframe is a virtual Mainframe and running on zOS 1.6 ADCD (Application Developers Controlled Distributions). The latest release of zOS is 1.13 but zOs 1.6 is more than enough for practicing. I’m not willing to talk about the virtualization of Mainframe.

**Important

Make sure you will not create some random user ids and run any infinite loop Programs on fandezhi mainframe. It is closely monitored by the admins and you may be banned from using dezhi mainframe if you do so.  The mainframe system is for people who wants to do the the things which are not possible at their work. Its so sad that the system is misused by a bunch of training center from India and that affects the complete system performance and other users. being a Dezhi MF user I‘ve personally experienced this. Again Make sure you don’t do the same. 

Also read the comments from fandezhi system Admin Prino.

All you need to have to use fandezhi/efglobe mainframe is

  • Get zOS credentials
  • Get a terminal emulator Program
  • Configure Terminal Emulator program and connect to efglobe mainframe

1. Get zOS Credentials

Go to efglobe/fandezhi mainframe support site using the below link

http://zos.efglobe.com/cgi-bin/mainframe/mainuser

Click on apply for new TSO ID, you will get the below screen

image

fill in your desired TSO ID, your name and your email id, then click on submit. After a while you will get an email with the TSO ID/Password and the Mainframe host IP etc.

As you see in the mainframe support site, you can

  • Apply for TSO ID.
  • Find you TSO ID (if you forgot yours)
  • Reset your ID
  • Renew your ID
  • Delete your ID
  • Disconnect your ID, if you disconnected from Mainframe by mistake and not able to login back.

2. Get a Terminal Emulator Program

I personally recommend IBM Personal communications, but it comes with a price tag. You can buy it (its really worth the money and its rich in features). If you prefer cheap/free you can get one of these

Once you download the terminal emulator go ahead and install it.

3.  Configure your Terminal Emulator program and connect to efglobe Host Mainframe.

If you are using IBM Personal communications then click on “Connections>Configure” and click on “link parameters”, then enter the host IP address you received on you email or you can use zos.efglobe.com and port 23.

image

In addition to this you can configure keyboard and graphics (if you want to use GDDM), since we all will be using different Terminal emulators I’m not going to cover it. Click on ok and connect to the host.

Here is the efglobe/fandezhi TSO Logon Page. You can use TSO, CICS, NETVIEW, NVAS and AOF. IMS will be working in this zOs configuration.

image

That’s, you know how to go from here. try it. Let me know if you get any problems while logging in.

Always comply to the rules and don’t misuse the system.

Thursday, November 22, 2012

Setup FTP from Mainframe to Non-Mainframe Method III

Using Microsoft IIS –FTP (Internet Information Services

As I Promised beginning of this series, here is the third method to transfer files from Mainframe to non Mainframe (Windows) . I have used Windows 7 X64 professional Operating system on my laptop and Internet Information Server 7.5.

You could also read other methods I’ve written about FTP’ing files from IBM Mainframe to Windows. These methods are easy to use and utilizes the free resources available in IBM Mainframe as well as Windows/free wares.

1. Simple FTP with Windows Bat file - http://mainframegeek.me/2012/11/20/setup-ftp-from-mainframe-to-non-mainframe-method-ii-using-bat-file/

2. Setup FTP with Filezilla server.

http://mainframegeek.me/2012/09/12/setup-ftp-from-mainframe-to-personal-computermethod-i-using-filezilla-server-on-windows/

3. Setup FTP with IIS (Internet Information Service) FTP server.

http://http://mainframegeek.me/2012/11/23/setup-ftp-from-mainframe-to-non-mainframe-method-iii/

By default Windows comes with Internet Information services. You just need to turn them on.

1. Turn On FTP server in Internet Information Services.

Navigate to Control Panel>Programs and features/Add or remove programs, and click on Turn windows features on or off. It will take  a while to turn on the service.

clip_image002_thumb[2]

2. Add a directory to our FTP server service

Navigate to Control Panel>Administrative tools and open Internet Information services

image

Right click on the FTP area and select View sites,

image

Now right click on the workspace and select add FTP site

Enter a FTP site name and choose directory where you want your incoming (From Mainframe) files stored to.

 clip_image008_thumb[2]

Click on next, select an IP Address (Copy to a text file for using in JCL) make sure you selected No SSL (you won’t be able to transfer files otherwise) and click on next. remember I said in the first method, FTP always uses port 21, so leave it as it is.

image

Click on Next and Enable anonymous authentication (or you can use a user id and password) and hit finish

clip_image012_thumb[2]

On the sites window, right click the FTP site you just created and select Basic Settings

3. Enable windows security

Click on connect as , then select specific user and click on set and enter your windows user id and password

image

Hit Ok for all the dialog boxes and go back to mainframe and edit your JCL as below

4. Submit FTP job from Mainframe

Copy paste the below JCL to your ISPF editor, make the changes as I mentioned below·

  • //STEP001 EXEC PGM=FTP,PARM='255.255.255.0 ---- Change IP address to the one you copied to text file during FTP server setup  (Step 2)
  • update windows (Same credentials you entered on Basic settings window) userid/pasword and file list on //INPUT DD*
  • Update your Data set names followed by the filename on windows on PUT statement

Complete JCL

//DDS1764J JOB NOTIFY=DDS1764
//STEP001 EXEC PGM=FTP,PARM='255.255.255.0 (EXIT'
//SYSPRINT DD SYSOUT=*
//OUTPUT DD SYSOUT=*
//INPUT DD *
Windows_user_id
Windows_user_password
DIR
PUT 'DDS1764.PGMG.CBL(FLEPGM)' ToIIS.txt
QUIT

Now Submit the JCL (it will complete with MAXCC 000). Due to security issues (I don’t want some spammer to submit random FTP jobs to my PC Winking smile ) I have blurred my ip address.

image 

Then check your shared folder (On your PC) for received file. Did you forget your shared folder? refer back to step 2 to see the folder.

· image

and That’s it now you are familiar with the 3 FTP methods which I know, FTP with IIS as well as Filezilla are same in a way, just the server software on the windows system is changing.

Try these three methods, let me know if you know any other methods (leave a comment on this page or email me @ shibubalakrishnan@live.com). 

If this tutorial helped you, please share the page on facebook, like it and please support me by clicking on the below ads.

Monday, November 19, 2012

Setup FTP from Mainframe to Non-Mainframe –Method II using Bat file

Here is another method with which you can transfer files from Mainframe to a windows Machine. To use this method you need to have a .Bat file and a file with list of files need to be transferred and valid Mainframe credentials.

You could also read other methods I’ve written about FTP’ing files from IBM Mainframe to Windows. These methods are easy to use and utilizes the free resources available in IBM Mainframe as well as Windows/free wares.

1. Simple FTP with Windows Bat file - http://mainframegeek.me/2012/11/20/setup-ftp-from-mainframe-to-non-mainframe-method-ii-using-bat-file/

2. Setup FTP with Filezilla server.

http://mainframegeek.me/2012/09/12/setup-ftp-from-mainframe-to-personal-computermethod-i-using-filezilla-server-on-windows/

3. Setup FTP with IIS (Internet Information Service) FTP server.

http://http://mainframegeek.me/2012/11/23/setup-ftp-from-mainframe-to-non-mainframe-method-iii/

Copy the contents of below table and save it as script.txt. You can save anywhere you want, I saved it on C:\temp1 folder. Change my_mainframe_userid and my_mainframe_password to your mainframe user id and password. By default the your HLQ (High level qualifier) will be your mainframe id, so whatever DD names you mention in the script file will have HLQ (High level Qualifier) padded, e.g HLQ.DDS1764.PGMG.CBL(ASCEBCB1) ,

To avoid this, we issue  cd ..    . Update the DD names with your list of data set names, you can either use PDS member names, a PS or Compressed (xmited) PDS or everything. there is no limit for the number of files, but keep in mind that this could eat a lot of bandwidth, followed by the destination file. Save this file as script.txt in your windows machine.

my_mainframe_userid
my_mainframe_password
cd ..
get "DDS1764.PGMG.CBL(ASCEBCB1)"  "C:\temp101.txt"
get "DDS1764.PGMG.CBL(ASCED)"  "C:\temp102.txt"
get "DDS1764.PGMG.CBL(ASMLNK1)"  "C:\temp103.txt"
get "DDS1764.PGMG.CBL(COB18DIG)"  "C:\temp104.txt"
get "DDS1764.PGMG.CBL(DIVZERO)"  "C:\temp105.txt"
quit

Copy the contents of below table and save it as batchftp.bat .   Before oyu save the file, change my_mainframe_ip  to your mainframe host ip for name. when you save the file from Microsoft notepad, make sure you choose file name: batchftp.bat and Save as type: All Files (*.*) .

echo off
cls
echo Batch FTP From Mainframe to Windows
echo   ***** Created by Shibu Thannikkunnath
echo   ***** mainframegeek@hotmail.com
echo   ***** http://mainframegeek.me
pause
ftp -s:script.txt my_mainframe_ip
exit
pause

 

Make sure you keep both the script.txt as well as the batchftp.bat file in the same folder. Now double click on the batchftp.bat to start download.  Once the script finished you can see all the transferred files in the folder mentioned in script.txt.

image

 

Try the script, let me know if you have any questions. If you think this tutorial helped you, don’t forget to like my facebook page, rate or share.  and support me by watching the below video (Ad)

-Cheers

Shibu

Wednesday, September 12, 2012

In this series, I’m going to cover the methods used for FTPing files from Mainframe to Non-Mainframe Platform.  Initially I’ll cover the processes to FTP from Mainframe and later I’m planning to cover the advanced topics like Secure FTP and FTF Methods.

The biggest Challenges while FTPing file from Mainframe are

In Mainframe Files are in EBCDIC format and Non-Mainframe platforms are in ASCII, so if you FTP files with packed Decimals in it (COMP, COMP-1, COMP-3 etc), Target system will not be able to read them properly, SO you need to unpack the fields before you transfer them over FTP

When Transferring Variable length (VB) files (Files with Occurs depending on fields in copybook) , the destination program has to modify to read the counter variable from File and then iterate to read the field. Another solution is that you can change the variable length record to Fixed length record prior to transmitting the file.

You could also read other methods I’ve written about FTP’ing files from IBM Mainframe to Windows. These methods are easy to use and utilizes the free resources available in IBM Mainframe as well as Windows/free wares.

1. Simple FTP with Windows Bat file - http://mainframegeek.me/2012/11/20/setup-ftp-from-mainframe-to-non-mainframe-method-ii-using-bat-file/

2. Setup FTP with Filezilla server.

http://mainframegeek.me/2012/09/12/setup-ftp-from-mainframe-to-personal-computermethod-i-using-filezilla-server-on-windows/

3. Setup FTP with IIS (Internet Information Service) FTP server.

http://http://mainframegeek.me/2012/11/23/setup-ftp-from-mainframe-to-non-mainframe-method-iii/

FTP uses Port 21, when you send files from zOS to Windows PC, zOS expects a FTP server listening on Port 21 at windows box. This is the bare minimum requirement for FTPing, (a client to send file and a FTP server on the receiver side). zOS has a FTP server built into it and that’s why we are able to send files from PC to Mainframe(Using Command prompt, Windows Shell is the next Method in this series).

You can use this method to transfer a single Member / a PDS or a huge list of PDS’es to Mainframe. There is no limit for the data which you can send over FTP but, it can burn down you company bandwidth Winking smile

When  you FTP a bunch of datasets, you can compress them into a single one or add as a list in the JCL. See this link to know about compressing the  dataset using IEBCOPY -http://mainframegeek.me/2011/01/20/the-iebcopy/

Step1. Make windows ready

· Step1. Download Filezilla – it’s a freeware/open-source software.

· Step2. Install

  • Just Double click on the exe file to install, accept all the defaults and click on finish.
  • Soon after the installation, filezilla server interface program will run and you will get a dialog box, just click ok. You will be on the server interface
  •  image
  • Select Edit>Groups
  • Click on Add button and enter a group name (I used “Admin”), click on ok.
  • Click on the Shared folders Node on page Pane (Left Side), then click on Add button and choose a Folder where you want your FTP’ed file to be stored into. Select all the access (read/Write/delete) and click on set as Home directory
  •  image
  • Click on ok.
  • No go back to Edit>Users
  • Click on add button, Enter a user name click on Ok and check password box and enter a password and click on ok. 9Make a note of User id and password, you need to provide this in the JCL you submit from Mainframe)
  •  image
  • Click on Ok.
  • Now your system is ready and listening to PORT 21, user id/Password will the one you created in previous step.

Step2. FTP File from Mainframe.

//DDS1764J  JOB NOTIFY=DDS1764                        
//STEP001 EXEC PGM=FTP,PARM='<your Windows machine IP> (EXIT'
//SYSPRINT  DD SYSOUT=*                               
//OUTPUT    DD SYSOUT=*                               
//INPUT     DD *                                      
<Enter your filezilla User Id>                                                     
<Enter your File zilla Password>                                               
DIR                                                   
PUT '<Source PDS(Member) or PDS' 'Target file_name.txt'  
PUT '<Source PDS(Member1) or PDS' 'Target file_name1.txt'
PUT '<Source PDS(Member2) or PDS' 'Target file_name.txt'        
QUIT
                                                                                     

Changes on the above jcl

  • Update your machine IP address on Step001. If you don’t know your system password, go the end of this webpage  - //STEP001 EXEC PGM=FTP,PARM='<your Windows machine IP> (EXIT'
  • Update Filezilla user id and password in input - in the above jcl, <Enter your filezilla User Id>, <Enter your File zilla Password>
  • Update the put command with your file list -  PUT '<Source PDS(Member) or PDS' 'Target file_name.txt'
  • Submit JCL

image

Once you submit the JCL you can monitor the log on filezilla screen.

image

Step3. Confirm reception of file.

You can see the FTP’ed file on the Filezilla Home directory (Directory you added while installing filezilla).

clip_image002[9]

 

How to Find Host IP Address sin windows Windows

  • Go to Windows Command Prompt and type “IPCONFIG” and Press Enter.
  • Scroll down till you see the IPv4 address, I have blurred my IP address in the screenshot due to security issues.
  • image

 

That’s it for the day, Guys If this tutorial helped you or if it’s a useful information then please promote my website by sharing on facebook, g+ or or by rating the page.

If you have any questions or suggestions please add it into the comment section or email me to shibuthannikkunnath@gmail.com.  For the guys who suggested the topics, please keep visiting my website, I’ll be adding them soon.

Cheers

-Shibu Thannikkunnath-