Difference between revisions of "SNDTWTMSG"

From MidrangeWiki
Jump to: navigation, search
(+CLP category)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
Want a simple and free way to send a message to Twitter from your System i? Here you go. I am releasing this as an Open Source release. Please improve on the coding and update this page with your changes.
 
Want a simple and free way to send a message to Twitter from your System i? Here you go. I am releasing this as an Open Source release. Please improve on the coding and update this page with your changes.
  
You will need the AIX binary of cURL from [http://computer-refuge.org/classiccmp/aixpdslib/pub/curl/RISC/4.3/exec/ here]. You will need version 7.13.1. Once extracted, put the curl object into a folder on the IFS.
+
You will need the AIX binary of [http://curl.haxx.se/ cURL] from [http://computer-refuge.org/classiccmp/aixpdslib/pub/curl/RISC/4.3/exec/ here]. You will need version 7.13.1. This version, from AIX 4.3 is known to work on IBM i V5R4; other versions might work as well.  Once extracted, put the curl object into a folder on the IFS and install. The default installation uses the {{code|/usr/local}} tree, and [[PASE]] has {{code|/QOpenSys}} as its base, so I installed my curl in {{code|/QOpenSys/usr/local}}
  
 +
== Install curl ==
 +
# Download a [[RISC]] (Power PC) binary.  Use your favourite method to put it somewhere on the IFS.  I will use /home/addons for this example
 +
# call qp2term
 +
# cd /home/addons
 +
# uncompress curl.7.13.1.tar.Z (gives curl.7.13.1.tar)
 +
# cd /QOpenSys
 +
# tar xf /home/addons/curl.7.13.1.tar (installs curl in /QOpenSys/usr/local)
 +
# /QOpenSys/usr/local/bin/curl -V (tests it out; should see curl 7.13.1 (powerpc-ibm-aix4.3.2.0)...)
 +
At this point, curl is installed.  Press F3 to return to the i command line.
 +
 +
== Command processing program ==
 
SNDTWTMSG.CLLE
 
SNDTWTMSG.CLLE
 
             PGM        PARM(&USER &PASS &TWEET)
 
             PGM        PARM(&USER &PASS &TWEET)
Line 9: Line 20:
 
             DCL        VAR(&TWEET) TYPE(*CHAR) LEN(140)
 
             DCL        VAR(&TWEET) TYPE(*CHAR) LEN(140)
 
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(300)
 
             DCL        VAR(&CMD) TYPE(*CHAR) LEN(300)
             CHGVAR    VAR(&CMD) VALUE('/installedApps/curl/curl --basic +
+
             CHGVAR    VAR(&CMD) VALUE('/QOpenSys/usr/local/bin/curl --basic +
                           --user ' || &USER *TCAT ':' || &PASS *TCAT ' +
+
                           --user ' || &USER |< ':' || &PASS |< ' +
                           --data status="' || &TWEET *TCAT '" +
+
                           --data status="' || &TWEET |< '" +
                           http://twitter.com/statuses/update.xml')
+
                           <nowiki>http://twitter.com/statuses/update.xml</nowiki>')
 
             QSH        CMD(&CMD)
 
             QSH        CMD(&CMD)
 
             ENDPGM
 
             ENDPGM
  
 +
Special characters can be reviewed in the [[CLP]] article
 +
 +
== Command ==
 
SNDTWTMSG.cmd
 
SNDTWTMSG.cmd
 
             CMD        PROMPT('Send Tweet')
 
             CMD        PROMPT('Send Tweet')
Line 21: Line 35:
 
                           PROMPT('User Name')
 
                           PROMPT('User Name')
 
             PARM      KWD(PASS) TYPE(*CHAR) LEN(30) CASE(*MIXED) +
 
             PARM      KWD(PASS) TYPE(*CHAR) LEN(30) CASE(*MIXED) +
                           PROMPT('Password')
+
                           PROMPT('Password') DSPINPUT(*NO)
 
             PARM      KWD(TWEET) TYPE(*CHAR) LEN(140) CASE(*MIXED) +
 
             PARM      KWD(TWEET) TYPE(*CHAR) LEN(140) CASE(*MIXED) +
 
                           PROMPT('Tweet')
 
                           PROMPT('Tweet')
 +
 +
==See also==
 +
*[[Twitter]]
 +
 +
== External links==
 +
* [http://www.ibm.com/developerworks/linux/library/l-friendfeed/index.html Update Twitter from Linux command line] IBM developerWorks tutorial, Oct 2008
 +
 +
==Categories==
 +
[[Category:Open Source]]
 +
[[Category:PASE]]
 +
[[Category:CLP]]

Latest revision as of 20:55, 24 April 2009

Want a simple and free way to send a message to Twitter from your System i? Here you go. I am releasing this as an Open Source release. Please improve on the coding and update this page with your changes.

You will need the AIX binary of cURL from here. You will need version 7.13.1. This version, from AIX 4.3 is known to work on IBM i V5R4; other versions might work as well. Once extracted, put the curl object into a folder on the IFS and install. The default installation uses the /usr/local tree, and PASE has /QOpenSys as its base, so I installed my curl in /QOpenSys/usr/local

Install curl

  1. Download a RISC (Power PC) binary. Use your favourite method to put it somewhere on the IFS. I will use /home/addons for this example
  2. call qp2term
  3. cd /home/addons
  4. uncompress curl.7.13.1.tar.Z (gives curl.7.13.1.tar)
  5. cd /QOpenSys
  6. tar xf /home/addons/curl.7.13.1.tar (installs curl in /QOpenSys/usr/local)
  7. /QOpenSys/usr/local/bin/curl -V (tests it out; should see curl 7.13.1 (powerpc-ibm-aix4.3.2.0)...)

At this point, curl is installed. Press F3 to return to the i command line.

Command processing program

SNDTWTMSG.CLLE

            PGM        PARM(&USER &PASS &TWEET)
            DCL        VAR(&USER) TYPE(*CHAR) LEN(30)
            DCL        VAR(&PASS) TYPE(*CHAR) LEN(30)
            DCL        VAR(&TWEET) TYPE(*CHAR) LEN(140)
            DCL        VAR(&CMD) TYPE(*CHAR) LEN(300)
            CHGVAR     VAR(&CMD) VALUE('/QOpenSys/usr/local/bin/curl --basic +
                         --user ' || &USER |< ':' || &PASS |< ' +
                         --data status="' || &TWEET |< '" +
                         http://twitter.com/statuses/update.xml')
            QSH        CMD(&CMD)
            ENDPGM

Special characters can be reviewed in the CLP article

Command

SNDTWTMSG.cmd

            CMD        PROMPT('Send Tweet')
            PARM       KWD(USER) TYPE(*CHAR) LEN(30) CASE(*MIXED) +
                         PROMPT('User Name')
            PARM       KWD(PASS) TYPE(*CHAR) LEN(30) CASE(*MIXED) +
                         PROMPT('Password') DSPINPUT(*NO)
            PARM       KWD(TWEET) TYPE(*CHAR) LEN(140) CASE(*MIXED) +
                         PROMPT('Tweet')

See also

External links

Categories