Typeset -i in MVS (Mainframe system)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Typeset -i in MVS (Mainframe system)
# 1  
Old 12-27-2012
Typeset -i in MVS (Mainframe system)

Hi,

I have one job that runs daily and creates daily files. At the end I compare the today's file with previous day's file. And if today's file size is greater or equal to previous day's file, then it is ok, else I need to through error.
I have following piece of code:
Code:
typeset -i SIZE_CURRDATE
typeset -i SIZE_PREVDATE
DAY=`echo $RUN_DATE | cut -c 5-6`
if [ $DAY -ne "01" ] ; then
SIZE_CURRDATE=`m_ls -l mfile:file_name |  awk '{ print $5 }' | sed 's/,//g'`
SIZE_PREVDATE=`m_ls -l mfile:file_name |  awk '{ print $5 }' | sed 's/,//g'`

echo "PREV_DATE : " $PREV_DATE
echo "SIZE_CURRDATE : " $SIZE_CURRDATE
echo "SIZE_PREVDATE : " $SIZE_PREVDATE
if [ $SIZE_CURRDATE -le $SIZE_PREVDATE ] ; then
 echo "ERROR : The output file is of zero length."
 exit -1
else
 echo "OK"
fi
fi

This runs fine in AIX UNIX. But it is giving arithmatic overflow error in MVS USS system when file size is more or equal to 10 digits.
Could you please help me to solve this?
# 2  
Old 12-27-2012
If your shell supports the -l option in typeset, try to define your variables with typeset -il. That gives you the long version of integer variables.

Code:
$ typeset -i var1=2222222222
$ typeset -il var2=2222222222
$ print -- $var1 $var2
-2072745074 2222222222

(using ksh93t+ on Solaris 10)
# 3  
Old 12-27-2012
Hi,
Thanks a lot for your reply!
I am running it in MVS system. So using
Code:
typeset -il

also giving arithmatic overflow error.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Migrating jobs from COBOL Mainframe system to UNIX system

In a nutshell requirement is to migrate the system from mainframe environment to UNIX environment (MF cobol would be used I guess). I have not much of idea in this field. I need to do some investigation on following points - - Ease of conversion - Known Data compatibility issue - Issue in... (9 Replies)
Discussion started by: Tjsureboy4me
9 Replies

2. UNIX for Advanced & Expert Users

MVS compression that unix can uncompress

Dear all, I have been given the opportunity at the last minute to help on a project. There is a need to move some very large files from an MVS machine to an AIX one. The servers are remote with (I think) a 2Meg network pipe between them. The people on the project have been moving small... (1 Reply)
Discussion started by: rbatte1
1 Replies

3. Shell Programming and Scripting

Sending File from Unix to MVS

Hi, I am trying to send a txt file via FTP to the Mainframe or MVS. the file gets sent to the MVS but the user name gets appended to the file name. For eg if i am sending test.txt, in the mainframe it lands as username.test.txt. I tried putting the filename inside single quotes but I get an... (3 Replies)
Discussion started by: naveensraj
3 Replies

4. AIX

MVS DB2 Connection from AIX

Hi, I want to try to connect to a DB2 (MVS) database from an AIX, through my c++ custom program. Is anybody who knows how can I do this? Which libraries should I use? Should I have a DB2 connect installed on my AIX? Thank you in advance. (3 Replies)
Discussion started by: develo
3 Replies

5. Emergency UNIX and Linux Support

SFTP issue when connecting from MVS to AIX

Dear all, I was given the ID_DSA.pub by an MVS user, which I placed in the appropriate user's authorized_keys file. When the user tris to SFTP from their side to the AIX box, the following error is got: error: debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY ... (6 Replies)
Discussion started by: ggayathri
6 Replies

6. Shell Programming and Scripting

FTP files to target Mainframe system

Hi Experts... Greetings for the day..! I just want to FTP the files to mainframe system.. my code is not working..and also i need to put the files in a particular directory in a specific naming format... ftp -i -n ${HOST_NAME} << END_FTP user ${USER_NAME} ${PASSWORD} put ${FILE_NAME}... (3 Replies)
Discussion started by: spkandy
3 Replies

7. Shell Programming and Scripting

SFTP to MVS system

Hi All, I have written a script that transfers(FTP) files from Unix system to MVS system. Below is the code for it. ftp -inv $HOST<<ftp_test quote site LRECL=200 quote site BLKSIZE=28000 mput SOURCE DEST ftp_test Here I need the help, if the above code can get... (3 Replies)
Discussion started by: rinku11
3 Replies

8. Solaris

ftp flat file from MVS(OS390) to Solaris

I've been working on this for a while and decided to see if anyone else here had this same issue. I'm trying to ftp a file from a mainframe (OS390) to Solaris. Obviously this is easily done, however the file is somehow being stripped of data in comparison to the way we transfer the file via a... (5 Replies)
Discussion started by: douknownam
5 Replies
Login or Register to Ask a Question