× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: User Exit in COBOL
  • From: "R. Bruce Hoffman, Jr." <rbruceh@xxxxxxx>
  • Date: Thu, 22 Apr 1999 08:29:42 -0400

Harry D. Angkasa wrote:
> 
> 
>      I still looking for a sample COBOL user exit, any user exit.
>      can anybody help me?

Now, remember, you said ANY.

Following is a COBOL program that simply accepts any FTP connection and
logs it to a file using imbedded SQL.  

Why?  Client needed to know who was using FTP from their machine.  It is
left as an execise for the reader to add other logic to deny access
based on any of the parameters passed in to the exit program.

--- Read da COBOL *ON ---
       PROCESS NOMONOPRC DATETIME.

       Identification division.
        Program-id. "LogFtp".
       Data division.
        Working-storage section.

         01 the-user-id                     pic x(10).
         01 the-ip-address                  pic x(16).

           EXEC SQL include sqlca
             end-exec.

        Linkage section.

         01 p-application-id                pic s9(9) binary.
         01 p-user-id                       pic x(10).
         01 p-user-id-len                   pic s9(9) binary.
         01 p-authentication                pic x(10).
         01 p-authentication-len            pic s9(9) binary.
         01 p-client-ip                     pic x(16).
         01 p-client-ip-len                 pic s9(9) binary.
         01 p-return-code                   pic s9(9) binary.
         01 p-return-user                   pic x(10).
         01 p-return-password               pic x(10).
         01 p-return-current-library        pic x(10).

       Procedure division
           using p-application-id
                 p-user-id
                 p-user-id-len
                 p-authentication
                 p-authentication-len
                 p-client-ip
                 p-client-ip-len
                 p-return-code
                 p-return-user
                 p-return-password
                 p-return-current-library
                 .

       Clean-up-data.

           move spaces
             to the-user-id
                the-ip-address

           move p-user-id(1 : p-user-id-len)
             to the-user-id
           move p-client-ip(1 : p-client-ip-len)
             to the-ip-address
           .

       Log-Access.

           EXEC SQL
             insert
               into FTPLOGFILE
               values(current timestamp,
                      :the-user-id,
                      :the-ip-address)
             end-exec.

           move 1 to p-return-code

           exit program.
           stop run.

--- Read da COBOL *OFF ---

hope this helps.

ta.

-- 
===========================================================
R. Bruce Hoffman, Jr. -- IBM Certified AS/400 Administrator

-- The sum of all human knowledge is a fixed constant.
    It's the population that keeps growing!
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.