Logo
  • Products
    • SecOps Studio
  • Solutions
    • Pega Stack Shifter
  • Services
    • Pega Enablement
    • Pega Modernization
  • About
  • Contact
  • Blog
Code Vault

Integration Mapping – Parse Structured rule in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will see more in detail about the parse structured rule and the four specific methods.

This is the continuation of the previous blog article on Map structured rule. It is recommended to visit the Map structured article before proceeding here.

Integration Mapping – Map structured rule in Pega

What is Parse structured rule?

Used to parse the structured data into clipboard properties.

They are mostly in conjunction with service file rules.

It looks the same as map structured rule right?!

Important Note: If the source is of simple fixed structure, always use map structured rule  instead of parse structured rule.

This rule seems a bit complex rule to me!! Throughout my career with over 6 projects, I never saw using parse structured rule!! No worries, let’s explore it.

Where can you reference a parse structured rule?

1. You can use as parsing rule in Service file rule in Map to field to parse the input data

2. Activity can directly refer the parse structured rule using Apply-Parse-Structured method.

What are the configuration points in a Parse structured rule?

First, let’s start by creating a new parse structured rule.

Create and Open.

OOPS…. This look familiar. Yeah Pega uses the same template as activity rule.

Note: Technically the class Rule-Parse-Structured direct inherits from Rule-Obj-Activity. You can open and check the class rule form

Now you know, how a parse structured rule can handle complex structured parsing :). Parse structured rule can you most of the methods used by activity rule, also the pre-conditions and transitions. Again I will say, use it only when it is complex parsing!

We need to concentrate on four specialized methods, that can be used only in parse-structured rule

  1. Parse-Byte-Pos
  2. Parse-Char-Pos
  3. Parse-Fixed-Binary
  4. Parse-Packed-Decimal
Parse-Byte-Pos and Parse-Char-Pos

Both looks the same with the same method parameters.  You can see they use Offset and length to parse and map to a target property.

Important Note: Parse structured work with the cursor moving. We will see about it soon

The main difference is

Parse-Byte-Pos – Used to extract fixed number of bytes (using length and Offset) from java input byte stream. This can be used when you want to read some binary rule

Parse-Char-Pos – Used to extract fixed number of characters from input character stream. This can be used when you want to read text files.

It’s good to visit my previous article on Service-File rule. We will use the already created service-file rule and going to replace the parse delimited with parse structured.

Service File Configurations in Pega

This was the input file I used in the post, where the values are comma separated. Let’s make it structured one and remove the commas.

I know this is not a good example of structured input, because you know Name cannot be in a structured way!!

Now this is the structured agreement

0-1 represents Record type identifier

2-6 represents Name

7-8 represents Age

9-12 represents Sex

Note: The position starts with 0 instead of 1

Let’s use this parsing structure in our parse structured rule

We need to define it in 3 steps as shown below

Offset & length logic is a bit different from map structured rule. You can see the second and third step starts with offset 0, because, the cursor has moved after step 1 and so we need to always use Offset 0.

Let’s test this.

How to test a Parse Structured rule?

Step 1: Configure the 3 steps and save the parse structured rule

Step 2: Update the service file rule with the parse structured

Step 3: Trace open the service file and run the service-file by providing the file with structured data.

Good, but there is one issue!!

The run window says, Failure. From tracer, I found only the first record is parsed and failed for the next record!

On analyzing, Pega says to include some offset for line break or record breaks of 2 characters (This 2 characters length may vary based on OS and type of file). Also remember, we used 2 characters as line breaker in service file rule.

Step 4: Add a new step, to skip the end of line characters.

Note: TargetProperty is not mandatory

Again with the cursor moving, specify the offset as 0 and Length as 2

Step 5: Run the service file again and check.

You see service parsed all 3 records and ended successfully.

There are 2 more methods you can use in Parse structured rule

Parse-Fixed-Binary and Parse-Packed-Decimal

Both are applicable only when the input is of byte stream

Parse-Fixed-Binary

Instead of specifying position, using this method we can always set a fixed bytes value to a property.

For example – First 8 bytes to customer name, next 2 bytes to Age and so on

LittleEndian – Specifies the order in which bytes are stored. Visit the below link for more detail

https://searchnetworking.techtarget.com/definition/big-endian-and-little-endian

Parse-Packed-Decimal

Again this is specific when the input is in packed decimal format.

For more info on the packed decimal format, please visit the below link

https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/rzasd/padecfo.htm

You can specify the digits and decimal places in the method.

The digits and decimals are used to extract the input and convert the value to save it into characters.

We couldn’t see a working tutorial here. You can also check with Pega community posts to know more about it!!

Note: Always try to use map structured instead of parse structured. It’s easy guys!

Hope you understood something new in this article.

  • pega-integration
Code Vault Curators

A technical team dedicated to empowering the Pega ecosystem with in-depth knowledge, guided by Premkumar Ganesan's vision.

Post navigation

Previous
Next

Pega Courses

Pega courses can be accessed at https://myknowacademy.com

Search through the blog

Tags

activity authentication background-processing case-management data-model declarative-processing email-processing file-processing pega-core-concepts pega-integration process reporting security system-administration user-interface validation

Categories

  • Code Vault

Recent posts

  • Service REST – Usage and Configurations in Pega
  • Queue processor – Usage and Configurations
  • Data Pages Usage & Configurations in Pega
  • Requestor types in Pega
  • Case Locking Mechanism in Pega

Related Articles

Code Vault

Service REST – Usage and Configurations in Pega

December 18, 2024 Code Vault Curators

First of all, don’t think INTEGRATION is a difficult topic in PEGA. I would say Integration is much easier than creating an activity rule. Pega makes it simple for developers. All you need to do is configure the Integration rules. Pega takes care of the rest. Pega provides useful wizards and guides the developers in […]

Code Vault

Service SOAP – Usage and Configurations in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will see how a Pega application can host a SOAP web service. I request you to go through another blog article on Service-REST where I already talked about services in general – Update: The Concept of SOAP services remains the same across different Pega versions. The screenshots in this blog […]

Code Vault

Connect SOAP – Usage and Configurations in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will try to understand about Connect-SOAP in Pega. Update: The concept of SOAP Connector remains the same across different Pega versions. Most of the screenshots in this blog article were reused from Pega 7 version and few were updated. Use this blog article to learn the concepts and you can […]

Code Vault

Connect REST – Usage and Configurations in Pega

December 10, 2024 Code Vault Curators

In this blog article, we will try to understand about Connect-REST in Pega. Connect-REST is One of the most commonly used Connectors in Pega to integrate with external systems. Update: The concept of REST Connector remains the same across different Pega versions. Most of the screenshots in this blog article were reused from Pega 7 […]

About

MyKnowTech was born with a mission to bridge the gap between technical expertise and business needs. We are a boutique firm specializing in Pega solutions, delivering them with a personal touch. At the heart of our philosophy is a commitment to putting clients first.

Company
  • About
  • Leadership
  • Career
  • Contact
Resources
  • Blog
  • Services
  • Solutions
  • Insights

©  MyKnowTech B.V. All Rights Reserved.

  • Sitemap
  • Terms & Conditions
  • Privacy Policy