Joined: 06 Apr 2021 Posts: 123 Location: argentina
Hello, how are you?
I researched the forum but I could not find some clue of this requirement, I wandering how can I use the expression: OUTREC IFTHEN=(WHEN=....
in order to when some condition is fullfilled two rows are created.
Joined: 15 Aug 2015 Posts: 1245 Location: Bamberg, Germany
Please, provide Input data and desired Output data. Makes life much easier. Also use Code Tags when presenting Code,Data and/or Error Msgs (see Button named 'Code' that works as a toggle).
If you want to create multiple lines from a single input line, use OUTFIL and not OUTREC. See / for line break in a single coded BUILD statement.
Joined: 06 Apr 2021 Posts: 123 Location: argentina
Joerg.Findeisen wrote:
Please, provide Input data and desired Output data. Makes life much easier. Also use Code Tags when presenting Code and/or Data (see Button named 'Code' that works as a toggle).
Thanks for your attention.
For example if I have the next input
AABB1333
AACC4321
If the condition is
Code:
OUTREC IFTHEN=(WHEN=(2,2,CH,EQ,C'AB')
My desired output should be:
AB ID IS FOREIGNER
AB PRICE IS 1333
As I said earlier my intention was to use a double BUILD, each one for each new row when the condition was satisfied, but that did not work.
Thank you again, in the meanwhile I will add the tags.
Joined: 06 Apr 2021 Posts: 123 Location: argentina
Joerg.Findeisen wrote:
Please, provide Input data and desired Output data. Makes life much easier. Also use Code Tags when presenting Code,Data and/or Error Msgs (see Button named 'Code' that works as a toggle).
If you want to create multiple lines from a single input line, use OUTFIL and not OUTREC. See / for line break in a single coded BUILD statement.
This keyword / worked well.
This problem is solved.
Thank you again.
Hello, how are you?
I researched the forum but I could not find some clue of this requirement, I wandering how can I use the expression: OUTREC IFTHEN=(WHEN=....
in order to when some condition is fullfilled two rows are created.
With this I intended to if that condition was satisfied two rows were to be created. But it does not work.
Please can anybody give me a hand with this.
Thank you
Greetings.
1) The questions in the style “it does not work” only - they are not accepted at this forum
2) Please, check the syntax rules for IFTHEN operand, and for BUILD operand too, using any SORT manual, and follow those rules carefully. Do not use other rules except those of SORT utility.
Joined: 06 Apr 2021 Posts: 123 Location: argentina
sergeyken wrote:
Ali_gezer wrote:
Hello, how are you?
I researched the forum but I could not find some clue of this requirement, I wandering how can I use the expression: OUTREC IFTHEN=(WHEN=....
in order to when some condition is fullfilled two rows are created.
With this I intended to if that condition was satisfied two rows were to be created. But it does not work.
Please can anybody give me a hand with this.
Thank you
Greetings.
1) The questions in the style “it does not work” only - they are not accepted at this forum
2) Please, check the syntax rules for IFTHEN operand, and for BUILD operand too, using any SORT manual, and follow those rules carefully. Do not use other rules except those of SORT utility.
I searched in the reference book but I was not able to find this / keyword.
So this mate gave me the clue of that and I researched and could find the solution, Im open to sugerences if you think I posted badly my doubt in order to manage myself properly in this great forum of yours.
I searched in the reference book but I was not able to find this / keyword.
So this mate gave me the clue of that and I researched and could find the solution, Im open to sugerences if you think I posted badly my doubt in order to manage myself properly in this great forum of yours.
Thanks.
How did you try to look for it??? It took me about 15 seconds to find the first of each one:
Quote:
IFTHEN clauses:
Reformat different records in different ways by specifying how build, overlay, find/replace, or group operation items are applied to records that meet given criteria.
IFTHEN clauses let you use sophisticated conditional logic to choose how different record types are reformatted.
Blank lines or a new line. A new report record is to be started in the output record, with or without intervening blank lines.
If /.../ or n/ is specified at the beginning or end of the output record, n blank lines are to appear in the record.
If /.../ or n/ is specified in the middle of the trailer, n-1 blank lines are to appear in the record (thus, / or 1/ indicates a new line with no intervening blank lines).
Either n/ (for example, 5/) or multiple /'s (for example, /////) can be used. n can range from 1 to 255.
Joined: 06 Apr 2021 Posts: 123 Location: argentina
sergeyken wrote:
Ali_gezer wrote:
I searched in the reference book but I was not able to find this / keyword.
So this mate gave me the clue of that and I researched and could find the solution, Im open to sugerences if you think I posted badly my doubt in order to manage myself properly in this great forum of yours.
Thanks.
How did you try to look for it??? It took me about 15 seconds to find the first of each one:
Quote:
IFTHEN clauses:
Reformat different records in different ways by specifying how build, overlay, find/replace, or group operation items are applied to records that meet given criteria.
IFTHEN clauses let you use sophisticated conditional logic to choose how different record types are reformatted.
Blank lines or a new line. A new report record is to be started in the output record, with or without intervening blank lines.
If /.../ or n/ is specified at the beginning or end of the output record, n blank lines are to appear in the record.
If /.../ or n/ is specified in the middle of the trailer, n-1 blank lines are to appear in the record (thus, / or 1/ indicates a new line with no intervening blank lines).
Either n/ (for example, 5/) or multiple /'s (for example, /////) can be used. n can range from 1 to 255.
If n is omitted, 1 is used.
Yes, later with the help of the friend of the top of page with that keyword I could investigate this and achieve the resolution, but the manual of sort is kind of big and I was kind of sure that doing something with the build command I could in some way reach the solution, thats why I asked here because there are people who knows very deeply this kind of commands.
I don't want to noone to make my work, but I asked only a clue or some word to investigate and fortunetly this person helped me well.
Yes, later with the help of the friend of the top of page with that keyword I could investigate this and achieve the resolution, but the manual of sort is kind of big and I was kind of sure that doing something with the build command I could in some way reach the solution, thats why I asked here because there are people who knows very deeply this kind of commands.
I don't want to noone to make my work, but I asked only a clue or some word to investigate and fortunetly this person helped me well.
The full manual is probably big. But in your case you've got just a syntax error (which you refused to mention in your post). The syntax error is related to a minor single parameter of SORT utility; the whole syntax explanation of it is only a few lines of the manual (and most of them are quoted in my response). If you do not see the difference between "it did not work", and "syntax error in SSS parameter", - that makes the whole situation even worse.
You were not able to verify your own code against the detailed syntax description in the manual (even after getting the clear message about SYNTAX ERROR IN ...this... PARAMETER). That's a pity, with no difference what you've had in your mind...