By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,301 Members | 1,394 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,301 IT Pros & Developers. It's quick & easy.

C programming on Mainframe z/OS batch

P: 5
Hello,

I have a mainframe C program which I am attempting to pass a 16 character number such as 698... I defined mainf(int argc, char *argv[]). In my batch execution JCL I use a dd card of //SYSIN DD * then the 16 digit number.

Upon entering the program I have placed printf's to display what I am getting.

Here is what I receive for argc a 1 for argrv[0] SHA256 or the name of the program then argv[1] and it is nothing. Does anyone have any suggestions fetting to the number here? Obviously the number is not getting into the program.

Also I noticed that when I compile I have a compile option of NOCICS and I cannot find this compile parameter described.

Expand|Select|Wrap|Line Numbers
  1. void main (int argc, char*argv[]);
  2. printf("%x\n",argc);       
  3. printf("%s\n",argv[0]);    
  4. printf("%s\n",argv[1]);    
Thank you,

mpark090
Feb 20 '07 #1
Share this Question
Share on Google+
7 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Hello,

I have a mainframe C program which I am attempting to pass a 16 character number such as 698... I defined mainf(int argc, char *argv[]). In my batch execution JCL I use a dd card of //SYSIN DD * then the 16 digit number.

Upon entering the program I have placed printf's to display what I am getting.

Here is what I receive for argc a 1 for argrv[0] SHA256 or the name of the program then argv[1] and it is nothing. Does anyone have any suggestions fetting to the number here? Obviously the number is not getting into the program.

Also I noticed that when I compile I have a compile option of NOCICS and I cannot find this compile parameter described.

Code

void main (int argc, char*argv[]);
printf("%x\n",argc);
printf("%s\n",argv[0]);
printf("%s\n",argv[1]);

Thank you,

mpark090
Have you tried using printf with '%c' instead of '%s'?

And what do you mean by a '16 character number'? "fifteen hundred?" or 1234567890123456?
Feb 20 '07 #2

AdrianH
Expert 100+
P: 1,251
Hello,

I have a mainframe C program which I am attempting to pass a 16 character number such as 698... I defined mainf(int argc, char *argv[]). In my batch execution JCL I use a dd card of //SYSIN DD * then the 16 digit number.

Upon entering the program I have placed printf's to display what I am getting.
Hi mpark,

I'm not familiar with a JCL or DD cards, so I looked it up from google and found it on wikipedia here. From what it states, it looks like you can not pass a parameter to a DD card, but I only have the wiki for background so maybe I'm wrong. However, it does look like you can pass parameters using EXEC PGM or EXEC PROC.

Is this what you are looking for?


Adrian
Feb 20 '07 #3

P: 5
Hi mpark,

I'm not familiar with a JCL or DD cards, so I looked it up from google and found it on wikipedia here. From what it states, it looks like you can not pass a parameter to a DD card, but I only have the wiki for background so maybe I'm wrong. However, it does look like you can pass parameters using EXEC PGM or EXEC PROC.

Is this what you are looking for?


Adrian
Adrian,

Thank you so much. I did get the program to accept the value by passing it on the PARM of the EXEC card like such EXEC PGM=pgmanme,PARM='\223344444444444'. Just in case you want to run a C program in batch with main(agrc,argv).

Regards,

mpark090
Feb 21 '07 #4

P: 5
Have you tried using printf with '%c' instead of '%s'?

And what do you mean by a '16 character number'? "fifteen hundred?" or 1234567890123456?

Thank you. I never though about the '%c' so I'll give that a try.

As for the 16 character number, I have spent too many years with COBOL. I did, however, get the program to accept the input by using a PARM on the EXEC card. By saying PARM='\1234567890123456' the program gave me the number back in the SYSPRINT.

Regards,

mpark090
Feb 21 '07 #5

AdrianH
Expert 100+
P: 1,251
Adrian,

Thank you so much. I did get the program to accept the value by passing it on the PARM of the EXEC card like such EXEC PGM=pgmanme,PARM='\223344444444444'. Just in case you want to run a C program in batch with main(agrc,argv).

Regards,

mpark090
Glad to help, keep on coding :)


Adrian
Feb 21 '07 #6

RedSon
Expert 5K+
P: 5,000
Wow, how old is that system you are working on?
Feb 21 '07 #7

P: 5
Wow, how old is that system you are working on?
I think the operating system may be z/OS 1.7 as for the C compiler I haven't really detemined it's age. The COBOL compiler may be current.

How about we say ancient or maybe prehistoric? (making fun here). I've been in the business since 1973.

mpark090
Feb 28 '07 #8

Post your reply

Sign in to post your reply or Sign up for a free account.