Posted: Mon Aug 31, 2020 1:36 pm Post subject: Unstring using EasyTrieve - Variable data
Hi,
I have the below requirement and trying to do it via JCL mostly Easytreive. I referred earlier posts by Kolusu, but since the data length is varying in my case, I couldnt fully find a solution. Please help!
Input
Code:
S{"NAME":{"NAME1":"JOHNNY C","NAME2":"BRAVO","ADDRESS1":"433 SOUTH EAST STREET","CITY":"LAS VEGAS","STATE":"NV"}}
S{"NAME":{"NAME1":"PAUL JEAN G","NAME2":"WILSON","ADDRESS1":"6000 WILLIAMS BLVD","CITY":"TAMPA","STATE":"FL"}}
S{"NAME":{"NAME1":"MELANIE CHRIS","NAME2":"DUMMINY","ADDRESS1":"22100 VICTORY PARKWAY","CITY":"LOS ANGELES","STATE":"CA"}}
Output needs to be in formatted in fixed length as below
NAME1- 30
NAME2 - 30
ADDRESS1 - 30
CITY -17
STATE - 2
Code:
JOHNNY C BRAVO 433 SOUTH EAST STREET LAS VEGAS NV
PAUL JEAN G WILSON 6000 WILLIAMS BLVD TAMPA FL
MELANIE CHRIS DUMINIY 22100 VICTORY PARKWAY LOS ANGELES CA
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
Posted: Mon Aug 31, 2020 4:13 pm Post subject:
You have an Easytrieve problem not a JCL problem so why post in the JCL part of the forum instead of the Application Programming section the description of which specifically mentions Easytrieve? _________________ Utility and Program control cards are NOT, repeat NOT, JCL.
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Mon Aug 31, 2020 4:29 pm Post subject: Re: Unstring using EasyTrieve - Variable data
rockstar1986 wrote:
Hi,
I have the below requirement and trying to do it via JCL mostly Easytreive. I referred earlier posts by Kolusu, but since the data length is varying in my case, I couldnt fully find a solution. Please help!
rockstar1986,
As Nic pointed, JCL doesn't anything. It is the programs/utilities that converts the variable data into fixed length data.
DFSORT can parse out the information quite easily.
Joined: 02 Dec 2002 Posts: 629 Topics: 176 Location: Stockholm, Sweden
Posted: Wed Sep 02, 2020 4:29 am Post subject:
Kolusu - I like the fact that you include 2 examples of a solution (the SORT example certainly looks easier).
Rockstar1986's actual request for an Easytrieve solution makes me think of that saying "if all you've got is a hammer, every problem looks like a nail"
(I wonder if a colleague has told him that he must solve it using Easytrieve) _________________ Michael
Posted: Wed Sep 02, 2020 2:34 pm Post subject: Re: Unstring using EasyTrieve - Variable data
Hi Kolusu,
Much thanks. DFSORT works for me, but got another question. I wanted to convert the lower case to upper case on one of these fields(all should be fine too) and Im using TRAN=LTOU but fails with error. Please advise.
I was able to fix the issue, thank you. I was wondering if we can format a header to populate all "-" in DFSORT using HEADER1 parameter instead of hardcoding .. similar to program CODE - MOVE ALL '-' TO VARIABLE
Code:
NAME ADDRESS CITY ST
JOHN|1211 SUSAN DR |MORRIS CITY|CA
EXPECTED O/P
Code:
------------------------------------------------------------
NAME ADDRESS CITY ST
------------------------------------------------------------
JOHN|1211 SUSAN DR |MORRIS CITY|CA
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Thu Sep 03, 2020 12:50 am Post subject:
rockstar1986,
Please do NOT quote the entire post. It adds nothing but clutter.
rockstar1986 wrote:
Im using TRAN=LTOU but fails with error. Please advise.
The above is absolutely useless without you showing the relevant error messages. We cannot look over your shoulder, so post detailed information on what you're trying to accomplish. Do not make people guess what you mean. This will give you a much better chance of getting a good answer to your question.
rockstar1986 wrote:
I was wondering if we can format a header to populate all "-" in DFSORT using HEADER1 parameter instead of hardcoding .. similar to program CODE - MOVE ALL '-' TO VARIABLE
Quite simple. Add the following after the BUILD statement
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Thanks Kolusu.. One more question: Please advise.
Back to the original question, in the input if any of the field is missing, then looks like DFSORT is ignoring all fields after that and goes to next line.
Example:
In the below case, 2nd line is missing NAME2 in the input, i want to simply ignore that one field but still read the next fields and display the o/p. However this is not happening and all fields are ignored in the line.
Code:
S{"NAME":{"NAME1":"JOHNNY C","NAME2":"BRAVO","ADDRESS1":"433 SOUTH EAST STREET","CITY":"LAS VEGAS","STATE":"NV"}}
S{"NAME":{"NAME1":"PAUL JEAN G","ADDRESS1":"6000 WILLIAMS BLVD","CITY":"TAMPA","STATE":"FL"}}
S{"NAME":{"NAME1":"MELANIE CHRIS","NAME2":"DUMMINY","ADDRESS1":"22100 VICTORY PARKWAY","CITY":"LOS ANGELES","STATE":"CA"}}
DSFORT o/p
Code:
JOHNNY C BRAVO 433 SOUTH EAST STREET LAS VEGAS NV
PAUL JEAN G
MELANIE CHRIS DUMINIY 22100 VICTORY PARKWAY LOS ANGELES CA
Expected o/p
Code:
JOHNNY C BRAVO 433 SOUTH EAST STREET LAS VEGAS NV
PAUL JEAN G 6000 WILLIAMS BLVD TAMPA FL
MELANIE CHRIS DUMINIY 22100 VICTORY PARKWAY LOS ANGELES CA
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Thu Sep 03, 2020 1:11 pm Post subject:
rockstar1986 wrote:
Thanks Kolusu.. One more question: Please advise.
Back to the original question, in the input if any of the field is missing, then looks like DFSORT is ignoring all fields after that and goes to next line.
Example:
In the below case, 2nd line is missing NAME2 in the input, i want to simply ignore that one field but still read the next fields and display the o/p. However this is not happening and all fields are ignored in the line.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum