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 "ok" 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 "ok" 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 = "23" then
display "classe " com(nbligne) " inexistante"
display "presser enter"
accept attend
else
perform until (fs-fich = "10" or fs-fich = "00"
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 = "00" 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 "total pour " com(nbligne) " = " total-ed.
end program progfin.
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 "ok" 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 "ok" 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 = "23" then
display "classe " com(nbligne) " inexistante"
display "presser enter"
accept attend
else
perform until (fs-fich = "10" or fs-fich = "00"
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 = "00" 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 "total pour " com(nbligne) " = " total-ed.
end program progfin.