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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with command line

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
can you find my problem
with "accept lignes from ligne-com".

great thanks

please answer at tcherno_burns@hotmail.com

my source :
----------------------------------------------------------
identification division.
program-id.progfin.
environment division.
configuration section.
special-names.
switch-1 is int-1
on is int-on
off is int-off
command-line is ligne-com
decimal-point is comma.
input-output section.
file-control.
select fichier assign to"fichind.ind"
organization is indexed
access mode is dynamic
record key is numprod
alternate record key is libel with duplicates
file status is fs-fich.

data division.
file section.
fd fichier.
01 enreg-fichier.
02 numprod.
03 classe pic xx.
03 ident pic x(5).
02 libel pic x(20).
02 qte-stock pic 9(4)v99.
02 nb-champ pic 99.
02 tab-prix occurs 1 to 10 depending on nb-champ
indexed by ind-p.
03 date-deb pic 9(8).
03 date-fin pic 9(8).
03 prix pic 9(4)v99.
working-storage section.
01 lignes.
02 ligne occurs 1 to 11 depending on nbligne.
03 com pic xx value "XX".
03 pic x.
01 attend pic x.
01 nbligne pic 99.
01 prix-tot pic 9(9)v99.
01 total-ed pic z(8)9,99.
01 i pic 99.
01 fs-fich pic xx.
01 verif-date pic xx.
01 date-trav pic 9(8).
01 date-dec.
02 an-dec pic 9999.
02 mois-dec pic 99.
02 jour-dec pic 99.
01 mess pic x(20) value "date erronee".
01 resu-div pic 9999.
01 reste pic 9999.

procedure division.
declaratives.
sect1 section.
use after standard error procedure on fichier.
par1.
evaluate fs-fich
when "10"
continue
when other
display"erreur sur fichier : " fs-fich
end-evaluate.
end declaratives.

Main.
open input fichier.
accept lignes from ligne-com.
if (int-on) then
perform date-courante
else perform date-utilisateur
end-if.
move 1 to nbligne.
perform until (nbligne =11 or com(nbligne) = "XX")
perform trt
add 1 to nbligne
end-perform.
close fichier.
stop run.

date-courante.
accept date-trav from date.
add 20000000 to date-trav.
date-utilisateur.
move "ko" to verif-date.
perform until (verif-date ="ok")
display " enter la date de validitee du prix (aaaammjj): "
accept date-trav
move date-trav to date-dec
if ((date-trav <= 19010101) or (date-trav >= 29991231))
then display mess
else
if( (mois-dec < 01) or (mois-dec > 12))
then display mess
else
if(mois-dec = 02) then
divide an-dec by 400 giving resu-div remainder reste
if((reste = 0) and (jour-dec >= 29))
then display mess
else
divide an-dec by 100 giving resu-div remainder reste
if((reste = 0) and (jour-dec >= 28))
then display mess
else
divide an-dec by 4 giving resu-div remainder reste
if((reste = 0) and (jour-dec >= 29))
then display mess
else
if(jour-dec >= 29)
then display mess
else move &quot;ok&quot; to verif-date
end-if
end-if
end-if
end-if
else if((mois-dec = 01) or (mois-dec = 03) or
(mois-dec = 05) or (mois-dec = 07) or
(mois-dec = 08) or (mois-dec = 10)
or (mois-dec = 12)) and (jour-dec >= 31)
then display mess
else if((mois-dec = 04) or (mois-dec = 06) or
(mois-dec = 09) or (mois-dec = 11))
and (jour-dec >= 30)
then display mess
else move &quot;ok&quot; to verif-date
end-if
end-if
end-if
end-if
end-if
end-perform.

trt.
move 0 to prix-tot.
move com(nbligne) to classe.
read fichier record.
if (fs-fich = &quot;23&quot;) then
display &quot;classe &quot; com(nbligne) &quot; inexistante&quot;
display &quot;presser enter&quot;
accept attend
else
perform until (fs-fich = &quot;10&quot; or fs-fich = &quot;00&quot;)
set ind-p to 1
search tab-prix
when date-fin(ind-p) > date-trav
compute prix-tot = prix-tot + (prix(ind-p) * qte-stock)
end-search
read fichier next record
end-perform
if (fs-fich = &quot;00&quot;) then
set ind-p to 1
search tab-prix
when date-fin(ind-p) > date-trav
compute prix-tot = prix-tot + (prix(ind-p) * qte-stock)
end-search
read fichier next record
end-if
end-if.
move prix-tot to total-ed.
display &quot;total pour &quot; com(nbligne) &quot; = &quot; total-ed.

end program progfin.
 
Viz,

french, eh ? Interesting to see a mix of COBOl english and french names.
Anyway: what is &quot;ligne-com&quot; ?!! I know accepts from certain standard sources (like DATE and TIME) and from SYSIN, but the latter is strictly mainframe, probably.

Can you tell us in what environment you work, and how you can assign input sources outside the program ?

Good luck,
Ronald.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top