dbTalk Databases Forums  

PICK BASIC Unidata programming - newb needs help!

comp.databases.pick comp.databases.pick


Discuss PICK BASIC Unidata programming - newb needs help! in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Edukes
 
Posts: n/a

Default PICK BASIC Unidata programming - newb needs help! - 09-24-2010 , 08:15 AM






I sure hope this is a good place to post this? Anyways, I have
recently started at a new company which uses A Unidata/PICK/BASIC
system. I have absolutely 0 programming experience and my fiirst class
(in Denver, CO. at RocketSoftware) for the intro to Unidata Pick/BASIC
programminng isn't scheduled until january Soooo... I am hoping
that I can find help here during my first few months and try to mange
to do as much reading as possible in order to stay afloat. I have
found a few online publications (including Sisk's book on the subject)
that I think should help. If anyone here can help me with the
following "project" that I am using as practice I would be forever
grateful! here is what I am trying to do; I need to create a routine
(program) in our PICK/BASIC system that does the following;

allows a user to input two dates.
• Dates have to be valid
• Both dates have to be greater than the current date (today) and less
than a year from the current date
• The second date has to be greater than the first date

I have done a few smaller practice projects, but I guess I have not
gotten to the chapter that covers what I would GUESS is using the
OCONV tool to convert the dates and then somehow check to make sure
the rules above are enforced. I am hoping that by seeing this code
written out I can use it as a way to learn some of the syntax, and get
a better understanding of how to do something simple like this Like I
said, ANY help would be greatly appreciated!

Reply With Quote
  #2  
Old   
Brian Speirs
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 09-24-2010 , 12:36 PM






Hi,

For general multi-value resources, go to www.pickwiki.com

I would also recommend reading the "Getting Started in OpenQM" books
available from www.rushflat.co.nz While OpenQM is not UniData, it is
close enough that you'll be able to learn a lot.

Cheers,

Brian

On 24/09/2010 14:15, Edukes wrote:
Quote:
I sure hope this is a good place to post this? Anyways, I have
recently started at a new company which uses A Unidata/PICK/BASIC
system. I have absolutely 0 programming experience and my fiirst class
(in Denver, CO. at RocketSoftware) for the intro to Unidata Pick/BASIC
programminng isn't scheduled until january Soooo... I am hoping
that I can find help here during my first few months and try to mange
to do as much reading as possible in order to stay afloat. I have
found a few online publications (including Sisk's book on the subject)
that I think should help. If anyone here can help me with the
following "project" that I am using as practice I would be forever
grateful! here is what I am trying to do; I need to create a routine
(program) in our PICK/BASIC system that does the following;

allows a user to input two dates.
• Dates have to be valid
• Both dates have to be greater than the current date (today) and less
than a year from the current date
• The second date has to be greater than the first date

I have done a few smaller practice projects, but I guess I have not
gotten to the chapter that covers what I would GUESS is using the
OCONV tool to convert the dates and then somehow check to make sure
the rules above are enforced. I am hoping that by seeing this code
written out I can use it as a way to learn some of the syntax, and get
a better understanding of how to do something simple like this Like I
said, ANY help would be greatly appreciated!

Reply With Quote
  #3  
Old   
dawn
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 09-24-2010 , 03:19 PM



On Sep 24, 8:15*am, Edukes <dukalicious... (AT) gmail (DOT) com> wrote:
Quote:
I sure hope this is a good place to post this? Anyways, I have
recently started at a new company which uses A Unidata/PICK/BASIC
system. I have absolutely 0 programming experience and my fiirst class
(in Denver, CO. at RocketSoftware) for the intro to Unidata Pick/BASIC
programminng isn't scheduled until january Soooo... I am hoping
that I can find help here during my first few months and try to mange
to do as much reading as possible in order to stay afloat. I have
found a few online publications (including Sisk's book on the subject)
that I think should help. If anyone here can help me with the
following "project" that I am using as practice I would be forever
grateful! here is what I am trying to do; I need to create a routine
(program) in our PICK/BASIC system that does the following;

allows a user to input two dates.
• Dates have to be valid
• Both dates have to be greater than the current date (today) and less
than a year from the current date
• The second date has to be greater than the first date

I have done a few smaller practice projects, but I guess I have not
gotten to the chapter that covers what I would GUESS is using the
OCONV tool to convert the dates and then somehow check to make sure
the rules above are enforced. I am hoping that by seeing this code
written out I can use it as a way to learn some of the syntax, and get
a better understanding of how to do something simple like this Like I
said, ANY help would be greatly appreciated!
This might help just a little bit for starters, while examples and the
U2 documentation will be of more help for your specific assignment,
but you can get a little taste by looking especially at the last two
in the little trilogy of flashcards here

http://tincat-group.com/mv/trilogy.html

Welcome to the MV/PICK community. cheers! --dawn

Reply With Quote
  #4  
Old   
x
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 09-24-2010 , 03:44 PM



On Sep 24, 8:15 am, Edukes <dukalicious... (AT) gmail (DOT) com> wrote:
Quote:
• Dates have to be valid
• Both dates have to be greater than the current date (today) and less
than a year from the current date
Hi,
The date thing is a bit complicated because of the ways the date can
be entered.
You may enter Day Month Year, Month Day Year, Year Month Day etc.
Because you have a year worth of dates you may ignore the year
altogether because you know that if the user enters March and now is
September then is March next year for sure.
There is an issue when using numbers only that is:
3-7-2010 is it March 7th or July 3rd ?
If today is February both dates are this year's valid dates.
Therefore you should show the user the required format and validate
it.
For example:
PRINT 'First date [dd/MMM]: ':
GOSUB GET.DATE
IF OK THEN....
....

GET.DATE:
OK = 1
DT = ''
INPUT BUFF
IF BUFF MATCHES '2N"/"3A':@VM:'1N"/"3A' THEN
DT = ICONV(BUFF,'D')
IF DT MATCHES '1N0N' THEN
IF DT < DATE() THEN DT = DT + 365
RETURN
END
END
OK = 0
RETURN

In this example BUFF MATCHES... validates the format.
On my system (it is not Unidata) if successful the date conversion
ICONV(BUFF,'D') creates a number, otherwise leaves DT as is. Next
statement validates DT to be a number of at least 1 digit long "1N" to
as many as required (zero) "0N".
Note that @VM is CHAR(253) and this notation is not supported on all
Multivalue flavors.
Please note that the above validation is incomplete as it does not
work correctly for leap years.

A note about Mike's example:
nextyear = OCONV(today,"dd"):" ":OCONV(today,"dma"):" ":
(OCONV(today,"dy")+1)
does not work if today is February 29th.
Instead use:
nextyear = date() + 365

Reply With Quote
  #5  
Old   
Mike Wooding
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 09-24-2010 , 05:14 PM



Douglas Tatelman wrote:
Quote:
Welcome Edukes

I would do this
internal.date = ICONV(value,"D")
instead of this
038 internal.date = OCONV(value,"DI")
Genuine question, (bearing all the caveats from my original post in mind),
Why?

Thanks

Regards

Mike

Reply With Quote
  #6  
Old   
Douglas Tatelman
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 09-25-2010 , 09:44 AM



Because you'll get in internal date if it is valid in any format,
empty string if not valid.

I've only seen the DI used in dict items on certain releases, but
that's just me.

On Sep 24, 3:14*pm, "Mike Wooding" <mikewood... (AT) email (DOT) com> wrote:
Quote:
Douglas Tatelman wrote:
Welcome Edukes

I would do this
internal.date = ICONV(value,"D")
instead of this
038 internal.date = OCONV(value,"DI")

Genuine question, (bearing all the caveats from my original post in mind),
Why?

Thanks

Regards

Mike

Reply With Quote
  #7  
Old   
Erick D
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 10-06-2010 , 09:06 AM



On Sep 25, 10:44*am, Douglas Tatelman <doug... (AT) pickteam (DOT) com> wrote:
Quote:
Because you'll get in internal date if it is valid in any format,
empty string if not valid.

I've only seen the DI used in dict items on certain releases, but
that's just me.

On Sep 24, 3:14*pm, "Mike Wooding" <mikewood... (AT) email (DOT) com> wrote:



Douglas Tatelman wrote:
Welcome Edukes

I would do this
internal.date = ICONV(value,"D")
instead of this
038 internal.date = OCONV(value,"DI")

Genuine question, (bearing all the caveats from my original post in mind),
Why?

Thanks

Regards

Mike- Hide quoted text -

- Show quoted text -
Hey all!
Just wanted to say thanks to all who offered up any help/input! I got
it figured out after several days of reading (both Forums and the PICK/
BASIC books I found :-)

And help from all of you (and others) Thanks again!

Reply With Quote
  #8  
Old   
Erick D
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 10-06-2010 , 10:23 AM



Also, for anyone interested; here is what I ended up with (again
thanks to several peoples input and a LOT of reading) This works
exactly as I wanted it to, and as you can see I added a few extras for
"neatness"

* Dates have to be valid
* Both dates have to be greater than the current date and less than
a year from the current date
* The second date has to be greater than the first date
CS=@(-1) ; * CLEAR SCREEN
CLLN=@(-4); * CLEAR LINE
CRT CS
PROMPT ':'
DATE.OK=1
LOOP
CRT @(5,5):CLLN:'ENTER DATE 1 ':
INPUT DATE1
DATE1=UPCASE(DATE1)
IF DATE1='X' OR DATE1='' THEN GO 999
DATE1 = ICONV(DATE1,'D')
* IF DATE1 > DATE() THEN
* IF DATE1 < (DATE() + 365) THEN DATE.OK=0
* END
UNTIL (DATE1 > DATE()) AND (DATE1 < (DATE() + 365)) DO
CALL NT.ERRORS('INVALID! MUST BE GREATER THAN THE CURRENT')
REPEAT
CRT 'DATE OK'
LOOP
CRT 'ENTER DATE 2 ':
INPUT DATE2
IF DATE2='X' OR DATE2='' THEN GO 999
DATE2 = ICONV(DATE2,'D')
IF DATE2 > DATE() THEN
IF DATE2 < (DATE() + 365) THEN
IF DATE2 > DATE1 THEN EXIT
END
END
CRT 'INVALID! THIS DATE MUST BE GREATER THAN THE FIRST DATE
ENTERED'
REPEAT

999 END

Reply With Quote
  #9  
Old   
Douglas Tatelman
 
Posts: n/a

Default Re: PICK BASIC Unidata programming - newb needs help! - 10-09-2010 , 09:03 AM



Just to cut down on cycles, I would just assign a variable to date()
at the top so you don't have to execute the function constantly.

Cheers

On Oct 6, 8:23*am, Erick D <erickdu... (AT) gmail (DOT) com> wrote:
Quote:
Also, for anyone interested; here is what I ended up with (again
thanks to several peoples input and a LOT of reading) This works
exactly as I wanted it to, and as you can see I added a few extras for
"neatness"

* * Dates have to be valid
* * Both dates have to be greater than the current date and less than
a year from the current date
* * The second date has to be greater than the first date
* * * CS=@(-1) ; * CLEAR SCREEN
* * * CLLN=@(-4); * CLEAR LINE
* * * CRT CS
* * * PROMPT ':'
* * * DATE.OK=1
* * * LOOP
* * * * *CRT @(5,5):CLLN:'ENTER DATE 1 ':
* * * * *INPUT DATE1
* * * * *DATE1=UPCASE(DATE1)
* * * * *IF DATE1='X' OR DATE1='' THEN GO 999
* * * * *DATE1 = ICONV(DATE1,'D')
* IF DATE1 > DATE() THEN
* * *IF DATE1 < (DATE() + 365) THEN DATE.OK=0
* END
* * * UNTIL (DATE1 > DATE()) AND (DATE1 < (DATE() + 365)) DO
* * * * *CALL NT.ERRORS('INVALID! MUST BE GREATER THAN THE CURRENT')
* * * REPEAT
* * * CRT 'DATE OK'
* * * LOOP
* * * * *CRT 'ENTER DATE 2 ':
* * * * *INPUT DATE2
* * * * *IF DATE2='X' OR DATE2='' THEN GO 999
* * * * *DATE2 = ICONV(DATE2,'D')
* * * * *IF DATE2 > DATE() THEN
* * * * * * IF DATE2 < (DATE() + 365) THEN
* * * * * * * *IF DATE2 > DATE1 THEN EXIT
* * * * * * END
* * * * *END
* * * * *CRT 'INVALID! THIS DATE MUST BE GREATER THAN THE FIRSTDATE
ENTERED'
* * * REPEAT

999 END

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.