View previous topic :: View next topic
|
Author |
Message |
Kittu1
New User
Joined: 21 Jun 2023 Posts: 4 Location: India
|
|
|
|
Hi
I need to a JCL sortcard that prints only the records that has mj kl ll in the input if there is no such record in input it should print a new line in output that has mj kl ll and 0000 .
Thanks |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1334 Location: Bamberg, Germany
|
|
|
|
Either JCL or SORT. Provide proper input test data, and desired output. Consider using code tags when presenting any code or data.
What have you tried yourself to meet the requirement? |
|
Back to top |
|
|
Kittu1
New User
Joined: 21 Jun 2023 Posts: 4 Location: India
|
|
|
|
I have tried using this
SORT FIELDS=(1,2,CH,A)
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'MJ KL LL'),
BUILD=(1,8,13:13,10)),
OTHERWISE=(BUILD=(1:C'MJ KL LL',13:C'0000'))
INPUT DATA SET LOOKS LIKE THIS
MJ KI LL 0000001234
MJ KT LL 0000001154
NI KL LL 0000007684
In i/p ps file as the record is not present , i am expecting
MJ KL LL 0000 |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2140 Location: USA
|
|
|
|
1. Please, learn how to post your messages:
Kittu1 wrote: |
I have tried using this
Code: |
SORT FIELDS=(1,2,CH,A)
INREC IFTHEN=(WHEN=(1,8,CH,EQ,C'MJ KL LL'),
BUILD=(1,8,13:13,10)),
OTHERWISE=(BUILD=(1:C'MJ KL LL',13:C'0000'))
|
INPUT DATA SET LOOKS LIKE THIS
Code: |
MJ KI LL 0000001234
MJ KT LL 0000001154
NI KL LL 0000007684 |
In i/p ps file as the record is not present , i am expecting
|
2. What are the results of your attempts? |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1334 Location: Bamberg, Germany
|
|
|
|
It is not fully clear to me. If the record is not present, there is only that one line in the output? Or, if the record is not present, it should be added and other records are left untouched for the output? |
|
Back to top |
|
|
Kittu1
New User
Joined: 21 Jun 2023 Posts: 4 Location: India
|
|
|
|
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2140 Location: USA
|
|
|
|
Kittu1 wrote: |
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record |
My expectation is, you MUST get the message "SYNTAX ERROR", did you get it?
Always present the exact copy of your results, and messages.
Do not tell here only the fairy tales about your runs! |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1334 Location: Bamberg, Germany
|
|
|
|
Kittu1 wrote: |
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record |
That means your output is NOT the same as your output DSN? It's hard for me to follow you. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2140 Location: USA
|
|
|
|
Kittu1 wrote: |
After running the JCL, the output file is having all the records present in input file. But , my output should be having single record |
Unless you finally present here the whole and exact copy of your code, plus input data, plus log of execution, plus the results you have REALLY received, - before that time we can hardly help you, and even understand you... |
|
Back to top |
|
|
Joerg.Findeisen
Senior Member
Joined: 15 Aug 2015 Posts: 1334 Location: Bamberg, Germany
|
|
|
|
I give it a try. If your input is:
Code: |
MJ KI LL 0000001234
MJ KT LL 0000001154
NI KL LL 0000007684 |
You expect:
Code: |
****** ********************
000001 MJ KL LL 0000
****** ******************** |
But if you have:
Code: |
MJ KI LL 0000001234
MJ KT LL 0000001154
NI KL LL 0000007684
MJ KL LL 4711 |
Output should be:
Code: |
****** ************************
000001 MJ KI LL 0000001234
000002 MJ KT LL 0000001154
000003 NI KL LL 0000007684
000004 MJ KL LL 4711
****** ************************ |
? |
|
Back to top |
|
|
Kittu1
New User
Joined: 21 Jun 2023 Posts: 4 Location: India
|
|
|
|
Sorry, I am a student and I am trying to explain the question in the way I know.
The current output looks like this
****** ************************
000001 MJ KI LL 0000001234
000002 MJ KT LL 0000001154
000003 NI KL LL 0000007684
000004 MJ KL LL 4711
****** ************************
But the output i am expecting is
****** ********************
000001 MJ KL LL 0000
****** ******************** |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2140 Location: USA
|
|
|
|
Kittu1 wrote: |
Sorry, I am a student and I am trying to explain the question in the way I know.
The current output looks like this
****** ************************
000001 MJ KI LL 0000001234
000002 MJ KT LL 0000001154
000003 NI KL LL 0000007684
000004 MJ KL LL 4711
****** ************************
But the output i am expecting is
****** ********************
000001 MJ KL LL 0000
****** ******************** |
I repeat again, for the last time:
1) Learn how to use the Code button to present all your data properly
2) Please, demonstrate here ALL of the following
- your used code, in full
- your input data, in full
- the log messages of your test run (100% copied from //SYSOUT DD)
- your REAL output (100% copied from //SORTOUT DD)
In case you continue to ignore the recommendations, you are condemned to fix your issue by yourself |
|
Back to top |
|
|
|