Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to create an increment field

Status
Not open for further replies.

Kadalynn

Programmer
Mar 20, 2002
6
US
Hope someone out their can give me an answer. My company resently changed banks. With the new bank we have to put in a different file qualifer each time we send a file. The easy answer would be to have the Payroll department enter the qualifer each time they send a file. Well they want it automated. Go figure!
So here is my question-- How do I automate a counter in ProComm so that it checks the date and increments the file qualifer each day when they send a file? Any help with this would greatly appreciated!


Kadalynn :)
 
Kadalynn,

Give us an Example of the File Qualifier. Is it a Number String ??

Hank
 
Sorry about that... Yes the file qualifer is a string of numbers. The default is 000000. If you send more than one file a day you have to change the qualifer ex. 000001...000002... and so on for each new file sent that day.
 
I would think the best way would be to have an INI(txt) file that keeps track of this string value. Before sending check the previous value stored in the file, increment it, set your variable, and resave the value for next time. The commands for the file handling that you want to look at would be:

Fopen
Fclose

fgets
fputs

They have some good examples in the help section.
 
Kadalynn,

Each day the Qualifier Restarts to default ? 000000. Is this Correct ?

Example:

03/20/02 000000
03/20/02 000001
03/20/02 000002

03/21/02 000000
03/21/02 000001
03/21/02 000002

Hank
 
To take what Chris B said a little further, you can use the profilewr and profilerd commands to read from and write to your own INI file. You would just need to keep track of two variables - what was the last date that you processed a file and what was the last increment processed. If you haven't processed a file today yet (determined by reading the date field from the INI file), then you would set the date field to the current date and set the increment field to 000000. If you have processed a file today (determined by reading the date field), then you would increase the increment field by one after the file has been processed successfully.
 
Thanks for your help guys. Hank your example is completely correct. It does work exactly like that. I'm researching everything Chris and Knob gave me so far. Hopefully I will be able to have this knocked out rather quickly. If you have any other sugestions let me know. I really appreciate all of your help!!
 
Knob,
Thanks for pointing out those commands, funny I never came accross them before, but sure enough they are right there in the help file:) Sure beats the way I've been doing it. Think I'll go redo some scripts right now.


 
Glad I could help. I think one downfall of the current Procomm package is that it does not contain a printed ASPECT manual. Versions of Procomm up to 3.0 (maybe 4.0 but I doubt it) came with an ASPECT manual that is basically the ASPECT help file. I think it's a lot easier to skim through a manual to learn a language than reading through a help file. Quarterdeck did sell an ASPECT manual at one point in time, but I think they stopped this before being acquired by Symantec.
 
Kadalynn,

What was your final solution ? Would you mind posting the solution Script ?

Thanks

Hank
 
I don't mind posting the script I used. I made a function that opened a file and created a file qualifier. Turns out I didn't need to worry about the date as long as I have a different file qualifier for each transmission.

"
proc main
string qualifier
qualifier = getNextNum()
endprod

func getNextNum : string
;Name of file to read.
String FName = "C:\Program Files\Symantec\Procomm Plus\Download\filequal.txt"
String LineInfo ;Line from file.
integer intNum

if isfile FName
if fopen 0 FName READ
fgets 0 LineInfo
fclose 0
strtonum LineInfo intNum
strfmt s0 "%06d" intNum
;usermsg " The number in the file is %s ." s0

if intNum != 999999
intNum = intNum + 1
numtostr intNum LineInfo
else
intNum = 0
numtostr intNum LineInfo
endif

;usermsg " The LineInfo is now %s . " LineInfo
if fopen 0 FName CREATE
fputs 0 LineInfo
fclose 0
endif

else
errormsg "End of File encountered."
endif
else
errormsg "File doesn't exist."
endif
return s0

endfunc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top