View previous topic :: View next topic
|
Author |
Message |
Kishore Chebrolu
New User
Joined: 24 Jan 2011 Posts: 1 Location: Chennai
|
|
|
|
What is an API? And how it will work? What is the Difference Between an API and SubProgram?
Could you please Help on this Questions.
--
Sairam |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Application Programming Interace
Google is your friend. Googling api returns about 529,000,000 results and the very first one tells you what an API is. |
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 Location: Puerto Rico
|
|
|
|
Good day!
Robert gave you the difintion and where find to more informaton. I will add a little more to what is a API? If you know assembler, you code macros so it could be reusable in many programs and macros translates from one code with parms to a set of instructions to acomplish a programming task. API is something similar to a macro but for high level languages. When you code a API in your COBOL program that API has to be first trranslated before compilings your program. After translation the API code is commented out and a set of instructions are imbedded in your program to acomplish a programming task like reading a compress file and doing the expand at the same time, this API will be reusable in many programs to do same. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the additional info is misleading,
the translation stuff is just an irrelevant implementation detail
much better to stick to a good formal definition of the thing
quoting wikipedia ( which this time hit the nail right on the head )
as Robert said the first hit of a google search with API
Quote: |
An application programming interface (API) is a particular set of rules and specifications that software programs can follow to communicate with each other. It serves as an interface between different software programs and facilitates their interaction, similar to the way the user interface facilitates interaction between humans and computers.
An API can be created for applications, libraries, operating systems, etc., as a way of defining their "vocabularies" and resources request conventions (e.g. function-calling conventions). It may include specifications for routines, data structures, object classes, and protocols used to communicate between the <consumer> program and the implementer program of the API.[1][2]
|
|
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 Location: Puerto Rico
|
|
|
|
Enrico
That definition from Wikpedia is correct but confusing for someone that has use API code in an application program. From this definition a API could be a program which read an input file from a program and prepares an extract file for another program but this is not what Kishore is looking for. Instead I explained an API code which is standarize code for a company to perform a programming task which is reusable in many programs. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
Robert gave you the difintion and where find to more informaton. I will add a little more to what is a API? If you know assembler, you code macros so it could be reusable in many programs and macros translates from one code with parms to a set of instructions to acomplish a programming task. API is something similar to a macro but for high level languages. When you code a API in your COBOL program that API has to be first trranslated before compilings your program. After translation the API code is commented out and a set of instructions are imbedded in your program to acomplish a programming task like reading a compress file and doing the expand at the same time, this API will be reusable in many programs to do same. |
your additions are just plain wrong !
an assembler macro is not an API
an API is just that... a set of rules and a set of services
You are confusing the rules with the implementation details
and furthermore You are giving an incomplete picture
from your wording an API is something that is implemented thru a preprocessor, and that is just wrong
a preprocessor is just one of the ways of implementing an API
take for example the ISPF
the user and the reference guide define an API which are the set of rules
to be followed in order to use ISPF services,
no preprocessor is involved just calls to the functions defined by ISPF! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Since this is posted under CICS, Kishore Chebrolu can look in the CICS manuals for the Front End Programming Interface manual. FEPI is an API, and reading the manual on it should help you understand what an API is and is not. A subprogram may invoke an API -- or may not, depending upon the coding. An API does not necessarily invoke a subprogram, either.
CICS commands are another API. The rules are that you invoke the API by coding EXEC CICS ... END-EXEC in your program. The CICS preprocessor finds those API invocations, converts them to language statements apprpriate to the language the program is coded in, and then the program can be compiled. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Quote: |
the additional info is misleading,
the translation stuff is just an irrelevant implementation detail
much better to stick to a good formal definition of the thing
|
I have to agree with Enrico and you are incorrect when you state
Quote: |
API is something similar to a macro but for high level languages. When you code a API... |
First, an API is not solely for use with high-level languages - they are fairly commonly used in Assembler programs. You don't code an API in a program, you code one or more API Commands from those available in an API in your program. The API commands typically implement a call to relevant (sub)system to utilise some function provided by that (sub)system.
API is not similar to a Macro as Macro does not provide an Interface to a (sub)system - it's simply a means of grouping instructions to provide for usability and readability when developing/maintaining code.
Garry. |
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 Location: Puerto Rico
|
|
|
|
Everybody has something to chip in and everybody is correct. I didn't state that a assembler macro is an API and I agree that in a program there's more than one API. My explanation was focus on Exec API XXXX, End-exec. IBM has an API guide and if you look into this book you will see that there's API for C, PL1, Etc. but for Assembler it's called a Macro API. I also agree with Robert that CICS Exec are API which needs to be translated before going thru the compiler. Thank you! |
|
Back to top |
|
|
|