Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

REXX Function: Output coming out when Function is done.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
jrlsage

New User


Joined: 11 Oct 2012
Posts: 5
Location: USA

PostPosted: Fri Oct 12, 2012 2:32 am    Post subject: REXX Function: Output coming out when Function is done.
Reply with quote

Code:

/* REXX */                                                     
/* trace i  */                       
/*                                                             


TICKETNUMBER=TICKET_NUMBER()                                     
SAY TICKETNUMBER                                                 
exit                                                             
                                                                 
TICKET_NUMBER:                                                   
     TICKET_LENGTH_CHECK= 0                                     
    SAY "What is the ticket number?"                             
  PULL TICKET_ENTRY_NUMBER                                       
     TICKET_NUMBER_CHECK=DATATYPE(TICKET_ENTRY_NUMBER,'N')       
     if TICKET_NUMBER_CHECK == 1 then do                         
       if WORDLENGTH(TICKET_ENTRY_NUMBER,1) = 1                 
       then TICKET_LENGTH_CHECK= 1                               
       if TICKET_NUMBER_CHECK =¬1 && TICKET_LENGTH_CHECK =¬1,   
       then                                                     
          do                                                     
          TICKETNUMBER=TICKET_NUMBER(TICKET_ENTRY_NUMBER)       
              return TICKET_ENTRY_NUMBER                         
          end                                                   
       else                                                     
          do                                                     
              return TICKET_ENTRY_NUMBER                         
          end                                                   
      end                                                       
     else RETURN DATACHECK_ERROR(NUMBERS TICKET_NUMBER())       
                                                                 
QUIT:                                                           
                                                                 
  say "CRITICAL ERROR -> Press Q to quit immediately or"         
  say "press any key to restart function"                       
    pull ERR_SEL                                                 
      if ERR_SEL = Q then exit                                   
     else return 0                                               

 DATACHECK_ERROR:                                                     
                                                                     
   PARSE ARG DATATYPE FUNCTION_NAME                                   
     SAY "You used the wrong DATATYPE, please enter" DATATYPE         
   RETURN FUNCTION_NAME                                               
                                                                     
 ERROR_CHECK:                                                         
                                                                     
   PARSE ARG myarg section part                                       
                                                                     
   if section = 1 then                                               
     do                                                               
      CALL QUIT                                                       
     end                                                             
   if part = 1 then say "You entered in a non number "               
     SAY "ERROR in" myarg "function. Returning you to that function" 
   RETURN TICKET_NUMBER()                                             


I am building this code to automate some things I have to do.

My problem is when I a user issues the wrong datatype, I have the code go into the DATACHECK ERROR Function. I get no output as it returns back into the main function. once the user enters in the correct datatype and the code finishes, all the Say's come out at the end of the program.
i.e

Quote:
What is the ticket number? e

What is the ticket number? e

What is the ticket number? e

What is the ticket number? e

What is the ticket number? 2

You used the wrong DATATYPE, please enter NUMBERS
You used the wrong DATATYPE, please enter NUMBERS
You used the wrong DATATYPE, please enter NUMBERS
You used the wrong DATATYPE, please enter NUMBERS
2




I would like to have the say come out as soon as the user goes into the function.

Any idea?
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Oct 12, 2012 3:44 am    Post subject: Reply to: REXX Function: Output coming out when Function is
Reply with quote

don' t You feel thatYou made things a bit too complicated ?
why call ticket_number recursively ?
that' s the reason for the message delay

describe the requirement, looks that the code can be made much more simple

here is a snippet which will ask for a <ticket number>
letting the user attempt five time

Code:
TICKETNUMBER=TICKET_NUMBER()
SAY TICKETNUMBER
exit

TICKET_NUMBER: procedure
    text = "What is the ticket number?"
    say text
    text = "wrong input - What is the ticket number?"
    pull numb
    do  i = 1 to 5 while ( length(numb) \= 1 | datatype(numb) \= "NUM" )
        say text
        PULL numb
    end
    if  i > 5 then do
        say "too many attempts"
        exit
    end
    return numb
Back to top
View user's profile Send private message
jrlsage

New User


Joined: 11 Oct 2012
Posts: 5
Location: USA

PostPosted: Fri Oct 12, 2012 8:35 pm    Post subject: Reply to: REXX Function: Output coming out when Function is
Reply with quote

Thanks for the quick reply:


I am using this EXEC to build Ticket information for our auditors, something to make our programmers work a little faster.

The requirements of this program (eventually) will be building all the information for these tickets, organize the information, and then using JCL to email the results to the programmer for simple copy and paste.

---------------------

I wanted to see if I could get the error detection outside the function to use in any other function I create in this EXEC, sort of a one stop shop.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Fri Oct 12, 2012 9:21 pm    Post subject: Reply to: REXX Function: Output coming out when Function is
Reply with quote

did anybody consider that using line mode input and output is NOT user friendly
and is quite outdated as interface ?

did anybody consider using ISPF panels for data entry and navigation?

when using ISPF panels simple validations can be done in the panel itself
the script will get control back only with valid data

furthermore ALL the needed data can be collected by a SINGLE panel and a single user interaction
Back to top
View user's profile Send private message
jrlsage

New User


Joined: 11 Oct 2012
Posts: 5
Location: USA

PostPosted: Fri Oct 12, 2012 11:35 pm    Post subject:
Reply with quote

So ISPF Panels are the way to go here?


Also, looking at this by a REXX perspective. Would pushing and pulling the output work?

Just curious.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Fri Oct 12, 2012 11:51 pm    Post subject: Reply to: REXX Function: Output coming out when Function is
Reply with quote

Quote:
So ISPF Panels are the way to go here?

Yes

Quote:
Would pushing and pulling the output work?

It is not clear what you mean.

What happened when you tried it?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sat Oct 13, 2012 12:01 am    Post subject: Reply to: REXX Function: Output coming out when Function is
Reply with quote

why push/pull

ISPF / REXX interface takes care of all the variable handling

suppose that You have a REXX variable named VAR1

when a panel is displayed , if it contains an output field named VAR1, the variable content will be displayed

if the panel contains an input field named VAR2
when Rexx will be back in control the REXX variable VAR2 will contain the data typed in by the user
Back to top
View user's profile Send private message
jrlsage

New User


Joined: 11 Oct 2012
Posts: 5
Location: USA

PostPosted: Fri Oct 19, 2012 1:42 am    Post subject:
Reply with quote

Thanks -

I saw a forum post on how to build panels.

Ill proceed with that.

I appreciate the effort to putting me on the right path. icon_smile.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1713
Location: UK

PostPosted: Fri Oct 19, 2012 2:58 am    Post subject:
Reply with quote

D o not use a forum post to educate yourself in writng ISPF panels - use the Dialog Developer's Guide and Reference (SC34-4821-09)
Back to top
View user's profile Send private message
jrlsage

New User


Joined: 11 Oct 2012
Posts: 5
Location: USA

PostPosted: Fri Oct 19, 2012 9:10 pm    Post subject:
Reply with quote

Oh yeah, the post pointed me to that and a bunch of manuals to help me on my quest.

Thanks icon_cool.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Syncsort - Hard coded Value in output PORYES SYNCSORT 1 Thu Nov 03, 2016 9:23 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us