Skip to main content

Hello again.

At the end of a process of booking a hotel need to send a mail to the end customer with the booking confirmation.
I have a pre-defined text (but can be changed) with the following format:
Booking nº @numres
Check-in: @datent
Check-out: @datsai

Is there any way I can replace the variables for their content?
The objective is the text look like this:
Booking nº 2748
Check-in: 05/20/2016
Check out: 05/25/2016

I have tried in various ways using the STRING comand and UNSTRING with the INSPECT but still could not reach the final format

Thanks

Best Regards

Alberto Ferraz

Hello again.

At the end of a process of booking a hotel need to send a mail to the end customer with the booking confirmation.
I have a pre-defined text (but can be changed) with the following format:
Booking nº @numres
Check-in: @datent
Check-out: @datsai

Is there any way I can replace the variables for their content?
The objective is the text look like this:
Booking nº 2748
Check-in: 05/20/2016
Check out: 05/25/2016

I have tried in various ways using the STRING comand and UNSTRING with the INSPECT but still could not reach the final format

Thanks

Best Regards

Alberto Ferraz

Something like this:

      01 mytext    string  value "This is booking: @numres for checkin on @dateent and checkout on @datsai".
      01 resnum    pic 9(4) value 2748.
      01 checkin   pic x(10) value "05/20/2016".
      01 checkout  pic x(10) value "05/25/2016".
      procedure division.
          set mytext to mytext::Replace("@numres", resnum::ToString)::Replace("@dateent", checkin)::Replace("@datsai", checkout)
          display mytext


Hello again.

At the end of a process of booking a hotel need to send a mail to the end customer with the booking confirmation.
I have a pre-defined text (but can be changed) with the following format:
Booking nº @numres
Check-in: @datent
Check-out: @datsai

Is there any way I can replace the variables for their content?
The objective is the text look like this:
Booking nº 2748
Check-in: 05/20/2016
Check out: 05/25/2016

I have tried in various ways using the STRING comand and UNSTRING with the INSPECT but still could not reach the final format

Thanks

Best Regards

Alberto Ferraz

Hi,

Again a clear shot, It works perfectly.

Thank you very much.

Best Regards

Alberto Ferraz


Hello again.

At the end of a process of booking a hotel need to send a mail to the end customer with the booking confirmation.
I have a pre-defined text (but can be changed) with the following format:
Booking nº @numres
Check-in: @datent
Check-out: @datsai

Is there any way I can replace the variables for their content?
The objective is the text look like this:
Booking nº 2748
Check-in: 05/20/2016
Check out: 05/25/2016

I have tried in various ways using the STRING comand and UNSTRING with the INSPECT but still could not reach the final format

Thanks

Best Regards

Alberto Ferraz

Another approach is to use the String::Format method with replacement variable numbers instead.

working-storage section.

01 mytext    string  value"This is booking: {0} checkin on {1} and checkout on {2}".

01 resnum    pic 9(4) value 2748.

01 checkin   pic x(10) value "05/20/2016".

01 checkout  pic x(10) value "05/25/2016".

procedure division.

     set mytext to type String::Format(mytext, resnum, checkin, checkout)

     display mytext


Hello again.

At the end of a process of booking a hotel need to send a mail to the end customer with the booking confirmation.
I have a pre-defined text (but can be changed) with the following format:
Booking nº @numres
Check-in: @datent
Check-out: @datsai

Is there any way I can replace the variables for their content?
The objective is the text look like this:
Booking nº 2748
Check-in: 05/20/2016
Check out: 05/25/2016

I have tried in various ways using the STRING comand and UNSTRING with the INSPECT but still could not reach the final format

Thanks

Best Regards

Alberto Ferraz

Thank you.

It also works well. Now I see what the best option will be.